GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — AsyncLocalStorage Next.js Error with Cloudflare Workers · Issue #18842 · getsentry/sentry-javascript

AsyncLocalStorage Next.js Error with Cloudflare Workers #18842

New issue
Copy link
New issue
Copy link
Closed
#18889
Closed
AsyncLocalStorage Next.js Error with Cloudflare Workers#18842
#18889
Copy link
Assignees
logaretm
Labels
Next.js

Description

@logaretm
logaretm
opened on Jan 16, 2026
Issue body actions

Description

Initially reported by @tristanbes in this issue

I just had an outage on my production because of this. I am, as i'm typing this message, deleting all server side integration with sentry that I followed from your docs.

Cannot call this AsyncLocalStorage bound function outside of the request in which it was created.

Environment:

  • Next.js: 15.5.9
  • @opennextjs/cloudflare: 1.14.8
  • @sentry/nextjs: 10.33.0
  • Deployment: Cloudflare Workers
  • Cloudflare Workers compatibility_date: 2025-11-17
  • Cloudflare compatibility_flags: nodejs_compat, global_fetch_strictly_public

Symptoms encountered:

  • AsyncLocalStorage errors when using Sentry.captureRequestError in the onRequestError hook (maybe with addBreadcrumb too)
  • Server-side Sentry initialization causes silent failures or "Server failed to respond" errors

Current workaround:
I've removed all server-side Sentry integration (deleted sentry.server.config.ts and sentry.edge.config.ts) and only kept client-side error tracking via instrumentation-client.ts. Client-side Sentry works fine.

The withSentryConfig wrapper in next.config.ts still works for source map uploads and the /monitoring tunnel route.

Is there an ETA for OpenNext/Cloudflare Workers support? Would love to have full-stack observability back. Happy to help test any beta/canary versions.

I haven't reproduced it yet, but it might be related to #18700

Reacted by Boyd Dames

Activity

  1. logaretm
    self-assigned this
    on Jan 16, 2026
  2. logaretm
    added
    Next.js
    on Jan 16, 2026
  3. linear commented on Jan 16, 2026

    @linear
    linearBot
    on Jan 16, 2026 – with Linear
    More actions

    JS-1480

  4. inooid commented on Jan 19, 2026

    @inooid
    inooid
    on Jan 19, 2026
    More actions

    I've created a reproducible repo with the last working version (and a PR with the latest non-working version) if that helps. This repo simply consists of:

    1. npm create cloudflare@latest -- my-next-app --framework=next
    2. npx @sentry/wizard@latest -i nextjs (replacing the DSN and config with env vars)

    ✅ The main branch is running @sentry/[email protected] and is confirmed to work
    ❌ The update-to-10-33-0 branch is running @sentry/[email protected] which does not work.

    In order to run:

    1. Checkout the repo
    2. npm install
    3. Setup .env with a SENTRY_DSN
    4. npm run preview to run opennextjs-cloudflare build && opennextjs-cloudflare preview
    5. Head to the localhost app /sentry-example-page and/or /api/sentry-example-api (e.g. http://localhost:8788/sentry-example-page)

    On main it looks like this as expected:

    Image

    On update-to-10-33-0 it looks like this:

    Image

    Let me know if there's anything else I can do to help out

    Reacted by Jan Peer Stöcklmair
  5. getsantry
    added
    Waiting for: Product Owner
    on Jan 19, 2026
  6. getsantry
    added this to GitHub Issues with 👀 3on Jan 19, 2026
  7. getsantry
    moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Jan 19, 2026
  8. logaretm commented on Jan 19, 2026

    @logaretm
    logaretm
    on Jan 19, 2026
    MemberAuthor
    More actions

    Thanks for the reproduction, it is indeed caused by #18700. I'm working on a fix right now.

    Reacted by Boyd Dames
  9. getsantry
    removed
    Waiting for: Product Owner
    on Jan 19, 2026
  10. getsantry
    moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Jan 19, 2026
  11. logaretm
    closed this as completedin #18889on Jan 19, 2026
  12. logaretm
    added a commit that references this issue on Jan 19, 2026

    fix(nextjs): Add ALS runner fallbacks for serverless environments (#1…

    This issue will close once commit 6c9317c is merged into the 'develop' branch.
    6c9317c
  13. github-actions commented on Jan 21, 2026

    @github-actions
    github-actionsBot
    on Jan 21, 2026 – with GitHub Actions
    Contributor
    More actions

    A PR closing this issue has just been released 🚀

    This issue was referenced by PR #18889, which was included in the 10.36.0 release.

  14. tristanbes commented on Jan 21, 2026

    @tristanbes
    tristanbes
    on Jan 21, 2026
    More actions

    Hello,

    Thanks @logaretm for creating an issue based on my initial report and @inooid for the reproducer ;
    I'm using Sentry since 2014 (if remembering correctly); Mainly for Symfony (PHP backend) / Javascript (frontend). I developped a blind trust for it.

    Since working with Next.js hosted in Cloudflare Workers, I only encountered weird issues/support that I never encountered with Symfony where all errors were successfully logged inside Sentry with context etc...

    I'm not even talking about the 10mb HARD limit for the code to be deployed on CF Workers; With Turbopack (default since Next.js 15.x) you cannot even tweak Sentry build like you would do for Webpack to "optimize" the size of the code shipped to the production

    I must admin that I lost confidence in using Sentry with Next.js / CF Workers since it crashed my production for my customers;
    How can you ensure this never happens in the future (Sentry crashing the app/site) ?

    Would you be open to make Sentry support for Next.js when running in CF Workers more a 1st class citizen ?

  15. logaretm commented on Jan 21, 2026

    @logaretm
    logaretm
    on Jan 21, 2026
    MemberAuthor
    More actions

    @tristanbes I understand your frustration and things like this should not happen. We are already discussing ways to ensure all of our SDKs (not just Next.js) work as expected across the different runtimes in the ecosystem.

    For Next.js specifically, I'm working on writing CF workers E2E tests which we didn't have before to cover this use-case and ensure we stay on top of runtime quirks with Next.js.

    Reacted by Tristan Bessoussa, Fredrik and Fedir Ushakov
  16. VyceeRulezU
    added a commit that references this issue on Sep 16, 2026

    feat: production-readiness Phase 2 — Sentry error monitoring

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

Metadata

Metadata

Assignees

  • @logaretm
    logaretm

Labels

Next.js

Projects

  • GitHub Issues with 👀 3
    Status
    No status
    Show more project fields

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.