Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Env Variables missing at build time for a next js app in cloud run

Hi all,

When trying to deploy a Next js app (v 15.3), the build requires env variables to be present at build time.
I tried making changes in my Docker file, and different combinations through the configurations in the UI, but nothing worked.

Is there any documentation on how to set these variables in a way that they are available at build time? It seems that Cloud Run is ignoring them.

Options that I have tried:

. Loaded the env variables when setting up my service and deploying in node js
. Loaded the env variables when setting up my service and deploying using a Docker configuration
. Loaded the env variables as overrides in the trigger (I'm deploying from Github)

Any guidance would be much appreciated.

Thanks in advance for your help

David

0 1 352
1 REPLY 1

Hi @dmetoki,

Welcome to the Google Cloud Community!

Thanks for sharing the troubleshooting steps you completed. Can you send your Docker file (make sure to remove sensitive info) and current configurations you’ve tried here? Also include screenshots of any error messages if any or audit logs to help pinpoint the issue.

For documentation about environment variables while deploying a Cloud Run service, refer to these resources:

For more help, check out the following Cloud Run support channels.

Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.