Skip to content

feat(apigw): add non-orgid/slug endpoints to proxied cell requests#115930

Merged
gi0baro merged 1 commit into
masterfrom
gi0baro/apigw-proxy-non-org-urls
May 21, 2026
Merged

feat(apigw): add non-orgid/slug endpoints to proxied cell requests#115930
gi0baro merged 1 commit into
masterfrom
gi0baro/apigw-proxy-non-org-urls

Conversation

@gi0baro
Copy link
Copy Markdown
Member

@gi0baro gi0baro commented May 20, 2026

SSIA

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label May 20, 2026
@gi0baro gi0baro force-pushed the gi0baro/apigw-proxy-non-org-urls branch from c4e967c to 06caa8b Compare May 20, 2026 18:41
@gi0baro gi0baro marked this pull request as ready for review May 20, 2026 18:43
@gi0baro gi0baro requested a review from markstory May 20, 2026 18:43
Comment thread src/apigw/dsl.py
Comment on lines +34 to +41
if (len(host_segments) - 2) < 3:
# If we don't have a o123.ingest.{cell}.{app_host} style domain
# we fallback to default
return get_cell_by_name(fallback)

try:
cell_segment = host_segments[-3]
return get_cell_by_name(cell_segment)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: The function get_cell_from_dsn hardcodes the number of domain segments, breaking error page embeds for deployments with different length domains (e.g., sentry.company.com or localhost).
Severity: HIGH

Suggested Fix

The logic for determining the cell name from the DSN host should be dynamic. Instead of hardcoding the segment offset, calculate it based on the length of the system.url-prefix segments, similar to the previous implementation in src/sentry/hybridcloud/apigateway_async/proxy.py.

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: src/apigw/dsl.py#L34-L41

Potential issue: The function `get_cell_from_dsn` incorrectly assumes the application's
host domain always consists of two segments (e.g., `sentry.io`). This is due to the
hardcoded logic `if (len(host_segments) - 2) < 3:` and `cell_segment =
host_segments[-3]`. For deployments with different domain lengths, such as self-hosted
instances on `sentry.company.com` or local development on `localhost`, this logic fails
to extract the correct cell name from the DSN. This causes `get_cell_by_name` to fail,
resulting in a 404 error and breaking the user feedback embed functionality for these
customers.

Did we get this right? 👍 / 👎 to inform future reviews.

@gi0baro gi0baro merged commit 39adaf2 into master May 21, 2026
61 checks passed
@gi0baro gi0baro deleted the gi0baro/apigw-proxy-non-org-urls branch May 21, 2026 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants