Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions devservices/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
x-sentry-service-config:
version: 0.1
service_name: synapse
description: Cell routing services (proxy + ingest-router).
modes:
default:
- synapse-proxy
- synapse-ingest-router

services:
synapse-proxy:
image: us-docker.pkg.dev/sentryio/synapse/image:latest
command: ["proxy", "--config-file-path", "/app/proxy.yaml"]
ports:
- "13000:3000"
- "13001:3001"
volumes:
- ./proxy.yaml:/app/proxy.yaml:ro
- synapse-proxy-cache:/tmp/synapse-cache
networks:
- devservices
restart: unless-stopped

synapse-ingest-router:
image: us-docker.pkg.dev/sentryio/synapse/image:latest
command: ["ingest-router", "--config-file-path", "/app/ingest-router.yaml"]
ports:
- "13002:3000"
- "13003:3001"
volumes:
- ./ingest-router.yaml:/app/ingest-router.yaml:ro
- synapse-ingest-router-cache:/tmp/synapse-cache
networks:
- devservices
restart: unless-stopped

volumes:
synapse-proxy-cache:
synapse-ingest-router-cache:

networks:
devservices:
name: devservices
external: true
68 changes: 68 additions & 0 deletions devservices/ingest-router.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
ingest_router:
listener:
host: "0.0.0.0"
port: 3000
admin_listener:
host: "0.0.0.0"
port: 3001

locator:
type: in_process
control_plane:
url: http://host.docker.internal:8000
backup_route_store:
type: filesystem
base_dir: /tmp/synapse-cache
filename: backup.bin
compression: zstd1
localities:
- "--monolith--"
locality_to_default_cell:
"--monolith--": "--monolith--"

locales:
"--monolith--":
- id: "--monolith--"
sentry_url: http://host.docker.internal:8000
relay_url: http://relay:7899

routes:
- match:
host: localhost
path: /api/0/relays/projectconfigs/
method: POST
action:
handler: relay_project_configs
locale: "--monolith--"
- match:
host: localhost
path: /api/0/relays/live/
method: GET
action:
handler: health
locale: "--monolith--"
- match:
host: localhost
path: /api/0/relays/register/challenge/
method: POST
action:
handler: register_challenge
locale: "--monolith--"
- match:
host: localhost
path: /api/0/relays/register/response/
method: POST
action:
handler: register_response
locale: "--monolith--"
- match:
host: localhost
path: /api/0/relays/publickeys/
method: POST
action:
handler: public_keys
locale: "--monolith--"

metrics:
statsd_host: "127.0.0.1"
statsd_port: 8126
36 changes: 36 additions & 0 deletions devservices/proxy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
proxy:
listener:
host: "0.0.0.0"
port: 3000
admin_listener:
host: "0.0.0.0"
port: 3001
locator:
type: in_process
control_plane:
url: http://host.docker.internal:8000
backup_route_store:
type: filesystem
base_dir: /tmp/synapse-cache
filename: backup.bin
compression: zstd1
localities:
- "--monolith--"
locality_to_default_cell:
"--monolith--": "--monolith--"
upstreams:
- name: sentry-dev-monolith
url: http://host.docker.internal:8000
routes:
- match:
host: localhost
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proxy route host match fails with non-standard port

Medium Severity

The proxy route specifies host: localhost, but the proxy's host matching logic in route_actions.rs compares the raw Host header value directly — it does not strip the port. For HTTP/1.1 requests to localhost:13000, the Host header is localhost:13000, which won't equal localhost, so the route silently fails to match and returns a 404. The ingest-router correctly strips ports before comparing, but the proxy does not. Removing the host constraint or including the port would fix this.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit cbd756b. Configure here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One other thing to think about is that our local dev environments run sentry on dev.getsentry.net and not on localhost.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah -- i think i'll need to test these against real sentry/relay to figure out the right values for the route config. for now, the whole block is just copy paste from the local config

path: /organizations/{organization}/*
action:
resolver: cell_from_organization
cell_to_upstream:
"--monolith--": sentry-dev-monolith
# default: sentry-dev-monolith
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Commenting out the default upstream in proxy.yaml causes organization lookups to fail with a 404, as the fallback logic is bypassed when no locality is provided.
Severity: MEDIUM

Suggested Fix

Uncomment the default upstream in proxy.yaml to restore the fallback mechanism. This will ensure that requests for organizations not found by the locator are routed to the monolith, preventing 404 errors in single-cell development setups.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: devservices/proxy.yaml#L32

Potential issue: With the `default` upstream in `proxy.yaml` commented out, any
organization lookup failure in the proxy results in a 404 error instead of falling back
to the monolith. The resolver in `proxy/src/resolvers.rs` calls `self.locator.lookup`
with `None` for the `locality`. The fallback logic in `locator/src/locator.rs`, which
relies on `locality_to_default_cell`, is only triggered when a `locality` is provided.
Consequently, a lookup failure returns `LocatorError::NoCell`, which becomes a `None`
upstream, leading to a 404. This breaks the intended fallback behavior for new or
unknown organizations in development environments.


metrics:
statsd_host: "127.0.0.1"
statsd_port: 8126
Loading