I have a React app that is deployed as a GCP App Engine Service. My App Engine runtime is nodejs14. It was working fine up until 20th April but then something changed from GCP side and the deployment started failing with "cannot find the required file - index.js" error.
The file is indeed present in my source and as I said, I haven't changed anything in the project that is also reflected with git status (so there is no possibility of deleting/moving the index.js file)
This only happens with gcloud deployment - the local build is successful and also the project runs without compilation issues (with npm run start).
Things I have tried:
Here is my app.yaml file:
Gcloud version: Google Cloud SDK 360.0.0 bq 2.0.71 core 2021.10.04 gsutil 5.3
As per @NoCommandLine's comment, there's a breaking change when deploying Nodejs buildpacks on Google App Engine. According to the April 11, 2023 release notes:
For all the services using the Node.js runtime,
npm run build
now automatically runs during deployment if you have the npmbuild
script defined in yourpackage.json
file.
In order to prevent your build from running the npm run build
script, you must either:
Add a gcp-build
script with an empty value in your package.json
file:
"gcp-build":""
. For details about configuring the package.json
, see
Node.js buildpacks configurations.
Add the GOOGLE_NODE_RUN_SCRIPTS
build environment variable with an
empty value such as GOOGLE_NODE_RUN_SCRIPTS=""
. For details about
specifying build environment variables see build_env_variables.