You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
meesvandongen opened this issue
Apr 18, 2023
· 2 comments
Labels
triageUnseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.upstreamThe issue dervies from one of next-auth dependencies
Including export { default } from "next-auth/middleware" causes an error in standalone mode:
warn - Compiled with warnings
./node_modules/next/dist/server/web/spec-extension/image-response.js
A Node.js API is used (process.turbopack at line: 47) which is not supported in the Edge Runtime.
Learn more: https://nextjs.org/docs/api-reference/edge-runtime
Import trace for requested module:
./node_modules/next/dist/server/web/spec-extension/image-response.js
./node_modules/next/server.js
./node_modules/next-auth/next/middleware.js
./node_modules/next-auth/middleware.js
This will in turn lead to these modules not being found by nextjs runtime.
It seems that because of the bundling strategy? ImageResponse is somehow included in the import. Doing so manually
I had the same issue with Nextjs-auth0 middleware and it looks like this auth as well. I have an open issue in Nextjs for this same error that you can track as well:
triageUnseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.upstreamThe issue dervies from one of next-auth dependencies
Environment
next@13.3.0
next-auth@4.22.0
Reproduction URL
https://github.com/meesvandongen/next-auth-repro-standalone-middleware
Describe the issue
Including
export { default } from "next-auth/middleware"
causes an error in standalone mode:This will in turn lead to these modules not being found by nextjs runtime.
It seems that because of the bundling strategy? ImageResponse is somehow included in the import. Doing so manually
Will cause a similar error.
If we inspect the output of the bundler, we can see the following, which is likely the cause:
An option would be to swap babel for
tsup
or justtsc
to produce esm modules.How to reproduce
Add a middleware.js file
set next.config.js
run the build
Expected behavior
The modules which are not supported are not included in the build.
The text was updated successfully, but these errors were encountered: