Hello,
I have a NextJs project and am trying to deploy the frontend in Cloud Run.
My environment variables aren't being recognized at runtime. The only way I can get them to work is by removing .env from my .gitignore which I'd prefer not to do.
I can see that the variables are set in the revision:
I am logging process.env.TEST to console and it's returning the undefined result. The same goes for the other variables (except NODE_ENV which is set as production by default).
NEXT_PUBLIC_BASE_URL is undefined while you can see it is set in the first screenshot, as is TEST.
Everything else in the app appears to be working correctly, but I can't work with my backend since the URL isn't coming through in the environment variable.
I've tried redeploying on github, redeploying the revisions, and nothing seems to be working.
Any ideas on how I could troubleshoot this further?
Thank you!
Hi @jsnyder ,
Welcome to the Google Cloud Community!
You can try the following troubleshoot options:
Let me know if it helped, thanks!