Authjs Cognito Provider is Incompatible with Next.js Middleware Edge Runtime #9969
Closed
bestickley
started this conversation in
Ideas
Replies: 1 comment
-
🤦 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Document best practice for using the Cognito Provider with Next.js in Authjs V5.
Background
Next.js (artificially) constrains middleware to run in an edge runtime environment meaning Node.js APIs are not available. This is a problem for the Autjs Cognito Provider which transitively uses Node.js APIs (stream). When I use the Cognito Provider in Next.js middleware I received the following error:
I'm a little confused because I don't know where Authjs is making the call to the
@smithy+util-stream
library.Proposal
In the discussion, Switchable Runtime for Middleware (Allow Node.js APIs in Middleware), it was proposed to
I'm experimenting with this approach, and wanted to document my findings.
TBD
Beta Was this translation helpful? Give feedback.
All reactions