feat(apigw): add non-orgid/slug endpoints to proxied cell requests#115930
Merged
Conversation
c4e967c to
06caa8b
Compare
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) |
Contributor
There was a problem hiding this comment.
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.
vgrozdanic
approved these changes
May 21, 2026
JonasBa
pushed a commit
that referenced
this pull request
May 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SSIA