I had multiple nodejs services deployed on Cloud Run. The value of NODE_ENV
was production
initially. However, it suddenly changed to development
for all the services.
production
?Attaching the log screenshot from one of the services.
Some additional info if it might help :
NODE_ENV
variable during deploymentWe had similar issue. I tried to re-deploy cloud functions from our pipeline from the previous week using updated env variables. The deployment was successful on previous week and now it failed. We use latest
as the google/cloud-sdk
version.
Found this link and was able to fix the deployment: https://pullanswer.com/questions/dont-set-google_experimental_nodejs_npm_build_enabled-by-default
Google Cloud Build now sets GOOGLE_EXPERIMENTAL_NODEJS_NPM_BUILD_ENABLED=true
as default and that triggers the NPM build automatically. Also NODE_ENV
changed from production
to development
as a side effect. Adding GCP script to package.json
didn't help as the deployment was still run as development
. Cloud Build installs dev dependencies and then prunes those later. To get similar results as before, we had to set these environment variables to the cloud function deployment:
GOOGLE_NODE_RUN_SCRIPTS: ''
NODE_ENV: 'production'