Skip to content

fix(otel): Share compatible async context storage between strategies - #24724

Draft
ihsraham wants to merge 1 commit into
getsentry:developfrom
ihsraham:fix/async-context-compatibility-24603
Draft

ihsraham wants to merge 1 commit into
getsentry:developfrom
ihsraham:fix/async-context-compatibility-24603

Conversation

@ihsraham

Copy link
Copy Markdown
Contributor

The plain and OpenTelemetry strategies reuse one AsyncLocalStorage instance but expect different store shapes. Use a compatible shape while preserving the instance and OpenTelemetry context, preventing the reproduced crashes.

The current isolation is also preserved when the same active scope created by the plain strategy is rebound after switching back to OpenTelemetry. Captured scopes and their descendants retain their saved context. Cloned or escaped plain scopes can still restore their older context; this does not provide general support for combining SDKs.

Local yarn build, yarn lint, yarn format:check, and root yarn test passed, including all 42 root test projects. The pinned Next/OpenNext fixture passed 12 tests with 16 existing skips; its OpenNext peer-version warning remains.

Fixes #24603.

@ihsraham

Copy link
Copy Markdown
Contributor Author

@JPeer264 I've opened the fix for #24603, which you flagged as a high priority. Could you review it when you have a chance?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using @sentry/nextjs and @sentry/cloudflare together crashes every request with context.getValue is not a function

1 participant