-
Notifications
You must be signed in to change notification settings - Fork 27.1k
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
Packages used in middleware can't read env vars >=12.05 #33043
Comments
After discussing with @sokra, seems that the proposed solution is split in two: * We need to make sure that the `process` polyfill uses `global.process` if available. This is because middlewares are bundled using `browser` target and therefore `process.env.MY_ENV` gets shimmed into `require('process').env.MY_ENV`. * Allow `process.env` to be statically analyzed for dependencies so they will be exported to the manifest. Related issues: * should fix #33043.
Hi, this has been updated in |
@ijjk I am using v12.0.8-canary.20 and still running into this issue |
I just tried |
Hey @cj can you please provide a repo with an example that fails? Seems like it is working for me: https://github.com/Schniz/next-test-3rd-party-env-vars 😃 |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
…l#33141) After discussing with @sokra, seems that the proposed solution is split in two: * We need to make sure that the `process` polyfill uses `global.process` if available. This is because middlewares are bundled using `browser` target and therefore `process.env.MY_ENV` gets shimmed into `require('process').env.MY_ENV`. * Allow `process.env` to be statically analyzed for dependencies so they will be exported to the manifest. Related issues: * should fix vercel#33043.
Run
next info
(available from version 12.0.8 and up)No response
What version of Next.js are you using?
12.0.5
What version of Node.js are you using?
16.3.0
What browser are you using?
chrome
What operating system are you using?
macOS
How are you deploying your application?
yarn dev
Describe the Bug
Packages used in middleware return undefined for
process.env.*
Expected Behavior
packages used in middleware should be able to read env vars
To Reproduce
https://github.com/braden-clerk/middleware-bug
This repo replicates the bug
The text was updated successfully, but these errors were encountered: