NEXT_PUBLIC env not working for me :sad:
Unanswered
Yuss posted this in #help-forum
YussOP
Hey devs, I'm currently trying to set up NEXT_PUBLIC_APP_ENV="preprod" to show this env variable on dashboard of my website and it doesn't work it .
Look to these screenshot of my code, .env and docker-compose :
Look to these screenshot of my code, .env and docker-compose :
8 Replies
YussOP
Note : I'm not using dotenv and this is my version of nextjs : Next.js v14.0.2
YussOP
do you think i need to add public env variable when i'm building image ?
for the moment i have docker container link to my .env
YussOP
it doenst work if i but env variable into github actions
f*ck
Burmese
yes - any
NEXT_PUBLIC_ vars are bundled at build timeif you want to support dynamic vars (not bundled) that are public (accessible on the client) you'll need to fetch them from the server
it's a bit of a pain to wire up yourself, but I just released a tool that can help.
some info about what it can do - https://dmno.dev/blog/dmno-nextjs-launch/
Would love to hear what you think! Also happy to help you get set up 🙂
some info about what it can do - https://dmno.dev/blog/dmno-nextjs-launch/
Would love to hear what you think! Also happy to help you get set up 🙂