-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[NextJs] process.env access causes undefined error when not polyfilling process.env #14193
Comments
It's unfortunate that I guess we should also support this use case given it makes sense to not use these APIs on the browser. Going to backlog, but PRs are welcome! |
ref: https://nextjs.org/docs/pages/api-reference/next-config-js/env Considering these are in the official Next.js docs, I'm even more hesitant in assuming any defaults where |
@AbhiPrasad I agree this is odd! In the project I discovered this on this option is set however when the polyfills option is turned off, these variables are not set for the client. I wonder if this is intended behaviour? |
Just so that we're aligned... you mean that if you set I looked a bit in the Next.js code base and I think what's happening here is that the Vercel folks may have forgotten that I honestly don't think we will work around this experimental option for now. I recommend turning it off. If it ends up becoming stable we will of course find a solution. |
Sorry - yes, you're absolutely right. It fails when set to false. My fault for writing up a bug report at 2am after figuring this out! That's fair enough - I do think you guys are right this should probably be an upstream change. I'll report this to Vercel. |
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/nextjs
SDK Version
8.37.1
Framework Version
Next 15.0.2
Link to Sentry event
No response
Reproduction Example/SDK Setup
Steps to Reproduce
next dev
with the config aboveTypeError: process.env is undefined
fallbackNodePolyfills
next dev
Expected Result
process.env
Actual Result
node_modules/@sentry/nextjs/build/cjs/client/index.js
'sinit
function has multiple calls toprocess.env
and assumes a polyfill.The text was updated successfully, but these errors were encountered: