Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error message when building nextjs with middleware #5374

Closed
belgattitude opened this issue Sep 17, 2022 · 0 comments · Fixed by #5372
Closed

Error message when building nextjs with middleware #5374

belgattitude opened this issue Sep 17, 2022 · 0 comments · Fixed by #5372
Labels
triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.

Comments

@belgattitude
Copy link
Contributor

Environment

System:
OS: Linux 5.14 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
CPU: (12) x64 Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
Memory: 3.48 GB / 15.30 GB
Container: Yes
Shell: 5.1.16 - /bin/bash
Binaries:
Node: 16.17.0 - ~/.nvm/versions/node/v16.17.0/bin/node
Yarn: 4.0.0-rc.18 - ~/.nvm/versions/node/v16.17.0/bin/yarn
npm: 8.15.0 - ~/.nvm/versions/node/v16.17.0/bin/npm
Browsers:
Chrome: 105.0.5195.125
Firefox: 104.0.2

Reproduction URL

belgattitude/nextjs-monorepo-example#2622

Describe the issue

When switching to middleware on an existing install, the following message appears when I build nextjs:

A Node.js API is used (process.versions at line: 6) which is not supported in the Edge Runtime.
Import trace for requested module:
../../node_modules/jose/dist/browser/runtime/jwk_to_key.js (...)
./src/middleware.ts

By looking at installed version (in the lock file):

$ yarn why
├─ next-auth@npm:4.10.3
│  └─ jose@npm:4.3.7 (via npm:^4.3.7)

The problem was fixed upstream in the jose library (starting from v4.8.0).

As next-auth depends on an older version (^4.3.7) and jose is a transitive dependency it wasn't updated to latest

Workarounds:

PR

#5372

How to reproduce

You can test it out by cloning belgattitude/nextjs-monorepo-example#2622 before the commit belgattitude/nextjs-monorepo-example@f7d8b1f (which update the lock to latest jose version).

Expected behavior

No error message when building nextjs and using middlewares (vercel)

@belgattitude belgattitude added the triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime. label Sep 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant