-
Notifications
You must be signed in to change notification settings - Fork 20
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
Server Side environment variables not working #35
Comments
Unfortunately, I have the same findings |
🎉 This issue has been resolved in version 1.7.0-alpha.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
@timsawtellgo1 - Thanks for reporting this. We're currently working on a production-ready solution for using the app dir. The problem with the current example is that server components are statically generated by default at build time. To ensure the env vars are loaded, the server component needs to be forced to be dynamic. I've updated the example. Can you give it a spin? :) Additionally, I've added an issue for tracing the overall app router support. See: #69 |
🎉 This issue has been resolved in version 1.7.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Hi 👋 (It's been a while, I know) We've completely revamped our solution to support Server Components and the App Router. 🙌 Please check the development branch for docs and examples. We've also published a version 2.0.0-alpha.1 on NPM. 🚀 |
🎉 This issue has been resolved in version 1.7.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This issue has been resolved in version 1.7.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
When following the instructions in the example app's README.md, the server side environment variables are undefined.
and visiting
http://localhost:3000/server-side
I seehowever visiting
http://localhost:3000/client-side
I seeI tried a few things, and the only way I could get the server side version to work was to set
NODE_ENV=development
when usingyarn start
.after running
NEXT_PUBLIC_FOO=foo-value BAR=bar-value NODE_ENV=development yarn start
I seeThis is not going to work in production because we need our NextJS app to run in production mode. It seems like the only way this library works as stated (identical server + client side environment variables) is if we run the app in development mode. Am I missing something?
Thanks heaps for this library by the way, gobsmacked when I learned of NextJS's approach to environment variables and this seems like a great way to solve it - I'm just unable to get server side env variables working in production mode though.
The text was updated successfully, but these errors were encountered: