Skip to content

force the middleware to use Node.js runtime#13229

Merged
gestchild merged 2 commits into
mainfrom
upgrade-identity-nextjs-auth0-v4
Jul 1, 2026
Merged

force the middleware to use Node.js runtime#13229
gestchild merged 2 commits into
mainfrom
upgrade-identity-nextjs-auth0-v4

Conversation

@gestchild

Copy link
Copy Markdown
Contributor

What does this change?

Force the middleware runtime to use Node.js so AsyncLocalStorage is available

I think this will fix the error we are having in the identity app currently on stage

Error: Invariant: AsyncLocalStorage accessed in runtime where it is not available

How to test

Deploy to stage and see if it works...

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR attempts to resolve a Stage error in the identity app (“AsyncLocalStorage accessed in runtime where it is not available”) by forcing the Next.js middleware to run in the Node.js runtime so Node-only APIs are available.

Changes:

  • Adds a Node.js runtime override for identity/webapp/middleware.ts.
Comments suppressed due to low confidence (1)

identity/webapp/middleware.ts:85

  • export const runtime = 'nodejs' is not the documented/supported way to opt Middleware into the Node.js runtime in Next.js 15.x; runtime selection for middleware is expected to be set via the exported config object (e.g. export const config = { …, runtime: 'nodejs' }). As written, this may be ignored and you’ll still be running in the default Edge runtime, so the AsyncLocalStorage error would persist.
export const runtime = 'nodejs';

@gestchild gestchild marked this pull request as ready for review July 1, 2026 12:47
@gestchild gestchild requested a review from a team as a code owner July 1, 2026 12:47
@gestchild gestchild merged commit b2d51d3 into main Jul 1, 2026
9 checks passed
@gestchild gestchild deleted the upgrade-identity-nextjs-auth0-v4 branch July 1, 2026 12:48
gestchild added a commit that referenced this pull request Jul 1, 2026
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.

3 participants