I have a simple express API that I deploy to GCP with `gcloud app deploy backend-test.yaml`
This has worked for years. The last time it worked was in a build on 4/17/2023. I went to deploy a new version tonight (5/3/2023) and I'm getting errors. I have not made any code changes to the project.
Below I will provide the failure logs, and the last successful build logs. I feel that some failure is causing my "prebuild" and "build" steps to be run, which is not expected because at the stage of running `gcloud app deploy`, the project is already built and ready to go.
I have reviewed the breaking changes of gcloud: https://cloud.google.com/sdk/docs/release-notes
Nothing stands out to me as something that would cause this
The errors I"m getting are:
$ gcloud --project $PROJECT_ID app deploy backend-test.yaml
Beginning deployment of service [backend-test]...
╔════════════════════════════════════════════════════════════╗
╠═ Uploading 2 files to Google Cloud Storage ═╣
╚════════════════════════════════════════════════════════════╝
File upload done.
Updating service [backend-test]...
........................................................................................................................................................................................................................................................................................................failed.
ERROR: (gcloud.app.deploy) Error Response: [9] Cloud build 7cefe471-3c6e-436e-81c8-b8cfdf0c49c3 status: FAILURE
> agresult@1.0.0 prebuild /workspace
> npm run lint && npm run clean
> agresult@1.0.0 lint /workspace
> eslint --fix -c .eslintrc.js --ext .js,.ts .eslintrc.js src ../shared
Oops! Something went wrong! :(
ESLint: 5.16.0.
No files matching the pattern "src" were found.
Please check for typing mistakes in the pattern.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! agresult@1.0.0 lint: `eslint --fix -c .eslintrc.js --ext .js,.ts .eslintrc.js src ../shared`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the agresult@1.0.0 lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /www-data-home/.npm/_logs/2023-05-04T01_29_25_279Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! agresult@1.0.0 prebuild: `npm run lint && npm run clean`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the agresult@1.0.0 prebuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /www-data-home/.npm/_logs/2023-05-04T01_29_25_299Z-debug.log
Full build logs: https://console.cloud.google.com/cloud-build/builds;region=us-east1/7cefe471-3c6e-436e-81c8-b8cfdf0c49c3?project=503984150903
Running after_script
00:01
Running after script...
$ rm /tmp/$CI_PIPELINE_ID.json
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 1
Last successful build on 4/17/2023 looks like this:
$ gcloud --project $PROJECT_ID app deploy backend-test.yaml
Beginning deployment of service [backend-test]...
╔════════════════════════════════════════════════════════════╗
╠═ Uploading 1 file to Google Cloud Storage ═╣
╚════════════════════════════════════════════════════════════╝
File upload done.
Updating service [backend-test]...
........................................................................................................................................................................................................................................................................................................done.
Setting traffic split for service [backend-test]...
...............................done.
Deployed service [backend-test] to [redacted]
You can stream logs from the command line by running:
$ gcloud app logs tail -s backend-test
To view your application in the web browser run:
$ gcloud app browse -s backend-test --project=agresult-1
Running after_script
00:01
Running after script...
$ rm /tmp/$CI_PIPELINE_ID.json
Cleaning up project directory and file based variables
00:01
Job succeeded
Solved! Go to Solution.
I found a fix but I have no idea why this happened in the last 2 weeks.
I had to add "gcp-build": "" to my package.json
I did this because of recommendation in the docs here: https://cloud.google.com/appengine/docs/standard/nodejs/runtime#npm_build_script
Again, no idea why this changed, but maybe it helps someone in the future