-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Recent change silently makes environment variables undefined
#36528
Comments
Do you know what version this last worked on? Thanks for the reproduction! |
My August 16th is the last time I can verify that it definitely worked, and the |
Strange. I'm not sure what is going on, because this code was working until August 16th (on Gatsby 4.16.0), but stopped working as soon as it was updated. I can even go back to 2021 in the file history, and it was successfully making API requests when loading the environment variable this:
I tried that bug repo with |
You are seeing this error because your project has a newer version of We've made the change that wouldn't make I'm happy to follow up on this if you find anything. |
It's strange, because that syntax was definitely working on my site until August 16th. I can't see any way that people could have used that API without that API key loading. The moment it became I'll post back here if I ever find the answer. It might be worth fixing anyway, because there are no warnings about why valid JS is failing. If a user sees that |
For us, this appears to have regressed from 4.14.1 to 4.15.0 |
Preliminary Checks
Description
This valid JavaScript was working in Gatsby components until a couple of weeks ago:
It now silently fails as
undefined
and only works with this syntax:Reproduction Link
https://github.com/j127/gatsby-bug
Steps to Reproduce
npm i
npm run build
Expected Result
const { GATSBY_MY_VAR } = process.env;
should load the environment variable.Actual Result
The variable is
undefined
.Environment
The text was updated successfully, but these errors were encountered: