Skip to content

ref(api): Note that matchOperation doesn't support path prefixes - #131275

Merged
BYK merged 2 commits into
masterfrom
fix/api-operation-match-prefix
Nov 17, 2026
Merged

BYK merged 2 commits into
masterfrom
fix/api-operation-match-prefix

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Part of #131203. Follow-up to #131235.

Sentry isn't supported when served under a path prefix, so matchOperation and createOperationMatcher in @sentry/api/operations strip API_BASE_PATH only at the start of the path, unlike parseApiPathScope. This adds a comment at that check saying /sentry/api/0/... is deliberately not an API path, so the difference isn't mistaken for a bug, and pins that prefixed paths match no operation. Matching behavior doesn't change.

via @BYK.

--

View Session [Sentry]

matchOperation and createOperationMatcher only stripped API_BASE_PATH at
the start of the path, so a self-hosted install served under a prefix,
such as /sentry/api/0/, matched nothing. Find the base path anywhere in
the path, as parseApiPathScope does.

Co-Authored-By: BYK <[email protected]>
@sentry-junior
sentry-junior Bot requested review from a team as code owners November 16, 2026 16:31
@sentry-junior
sentry-junior Bot requested a review from BYK November 16, 2026 16:31
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Nov 16, 2026

@BYK BYK left a comment

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.

self-hosted install served under a prefix, such as /sentry/api/0/organizations/acme/issues/, therefore matched no operation

This should never happen as we actively discourage and try to prevent serving sentry under a path. This is not a path we support or should be concerned about. You may wanna note this in the code to prevent opening PRs like this in the future.

Sentry isn't supported when served under a path prefix, so drop the
prefix search and note in the matcher that /sentry/api/0/... is
deliberately not an API path. A test pins that.
@sentry-junior sentry-junior Bot changed the title fix(api): Match operations under a self-hosted path prefix ref(api): Note that matchOperation doesn't support path prefixes Nov 17, 2026
@sentry-junior

sentry-junior Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

Makes sense, I've dropped the prefix search in e252a3e88ef. The matcher only strips API_BASE_PATH at the start of the path again, as on master. A comment at that check now says that Sentry isn't supported under a path prefix and that /sentry/api/0/... is deliberately not an API path. A test pins that a prefixed path matches no operation. The PR is now just that note, and I've retitled it to match.

@BYK
BYK merged commit 8b6fd57 into master Nov 17, 2026
82 checks passed
@BYK
BYK deleted the fix/api-operation-match-prefix branch November 17, 2026 20:02

This branch was successfully deployed

1 active deployment
Preview — e252a3e8 Deployed Nov 17, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant