feat(server-utils): Implement setAsyncLocalStorageAsyncContextStrategy - #22889
Merged
Conversation
Contributor
size-limit report 📦
|
mydea
force-pushed
the
fn/acs-server-utils
branch
from
July 31, 2026 07:32
bf0def2 to
0663385
Compare
mydea
force-pushed
the
fn/acs-server-utils
branch
from
July 31, 2026 08:14
204c646 to
cdafffe
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c04421b. Configure here.
mydea
force-pushed
the
fn/acs-server-utils
branch
from
July 31, 2026 09:38
c04421b to
98b3378
Compare
mydea
force-pushed
the
fn/acs-server-utils
branch
from
July 31, 2026 10:09
98b3378 to
313d70f
Compare
isaacs
approved these changes
Jul 31, 2026
isaacs
left a comment
Member
There was a problem hiding this comment.
I'm curious about the removal of the redis export, but overall this is a good refactor. Great opportunity to move stuff into server-utils and reuse across SDKs :)
…er-utils The export was dropped when index.ts was split into exports.ts, which broke the redis-common test. It is published public API, so removing it is breaking. The test was relocated into packages/core with a cross-package relative import; it belongs next to the code it tests.
The strategy was derived from the deno/cloudflare one, which passes the current scope by reference. Both the OpenTelemetry strategy and v10's node-core light strategy clone it, so without this, current-scope mutations leak out of an isolation fork.
Forking it discarded setUser/setTag/setContext calls made inside `withScope(scope, callback)`, since those write to the isolation scope. Both the OpenTelemetry strategy and the stack strategy share it here, as does `withScope` without an explicit scope.
The Cloudflare SDK calls `init()` inside `withIsolationScope`, so the client is bound to the scope forked for that request. Reading it from outside the handler only worked while the current scope was shared by reference.
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.

This unifies the ACS strategy from cloudflare and deno into server-utils.
Eventually this will also be used in node (when not in otel mode).
Also, this makes it easier to adjust this in follow ups as there is more centralization now.
This also adds an export to server utils package
@sentry/server-utils/no-diagnostic-channelwhich can be used e.g. by cloudflare or in the future by vercel-edge, in runtimes where this is not supported.