Search code examples
node.jstypescriptgoogle-app-enginegoogle-cloud-build

Google App Engine suddenly doesn't let me deploy my node.js app


I have a quite simple Node.js / typescript project that I was always able to build with npm run build and then deploy on Google App Engine Standard for Node.js with the command: cloud app deploy --version=x

Since today it gives the following error:

Do you want to continue (Y/n)?  y

Beginning deployment of service [default]...
╔════════════════════════════════════════════════════════════╗
╠═ Uploading 0 files to Google Cloud Storage                ═╣
╚════════════════════════════════════════════════════════════╝
File upload done.
Updating service [default]...failed.                                                                                                                                                                                                                                                                                    
ERROR: (gcloud.app.deploy) Error Response: [9] Cloud build 2e4915bf-4af5-4ede-80c8-196d55653451 status: FAILURE
> frontend@0.1.0 build
> webpack

assets by status 0 bytes [cached] 1 asset

WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value.
Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/

ERROR in main
Module not found: Error: Can't resolve './src' in '/workspace'
resolve './src' in '/workspace'
using description file: /workspace/package.json (relative path: .)
Field 'browser' doesn't contain a valid alias configuration
using description file: /workspace/package.json (relative path: ./src)
  no extension
    Field 'browser' doesn't contain a valid alias configuration
    /workspace/src is not a file
  .js
    Field 'browser' doesn't contain a valid alias configuration
    /workspace/src.js doesn't exist
  .json
    Field 'browser' doesn't contain a valid alias configuration
    /workspace/src.json doesn't exist
  .wasm
    Field 'browser' doesn't contain a valid alias configuration
    /workspace/src.wasm doesn't exist
  as directory
    existing directory /workspace/src
      using description file: /workspace/package.json (relative path: ./src)
        using path: /workspace/src/index
          using description file: /workspace/package.json (relative path: ./src/index)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /workspace/src/index doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /workspace/src/index.js doesn't exist
            .json
              Field 'browser' doesn't contain a valid alias configuration
              /workspace/src/index.json doesn't exist
            .wasm
              Field 'browser' doesn't contain a valid alias configuration
              /workspace/src/index.wasm doesn't exist

webpack 5.75.0 compiled with 1 error and 1 warning in 197 ms
Full build logs: https://console.cloud.google.com/cloud-build/builds;region=us-central1/2e4915bf-4af5-4ede-80c8-196d55653451?project=xxxxx

I am not sure why it is trying to run a build. I always did an npm run build locally and then ran the gcloud command to deploy. Some files required to do the build are in the .gcloudignore because I only want to upload the compiled javascript, not my typescript/webpack stuff. I never even looked at the cloud builds before, but now I see that previously successful ones never even attempted to do build on my project, and new attempts do.

I'm a hobby developer and don't have a support contract for Google cloud, and my hope is that somebody else ran into the same problem and can help me out.

Google Cloud SDK 413.0.0
alpha 2023.01.06
beta 2023.01.06
bq 2.0.84
bundled-python3-unix 3.9.12
cloud-datastore-emulator 2.3.0
core 2023.01.06
gcloud-crc32c 1.0.0
gsutil 5.17


To take a quick anonymous survey, run:
$ gcloud survey

Node.js version:

leejjon@mymachine:~/projects/Blindpool$ node --version
v18.14.1

My code can be found here: https://github.com/Leejjon/Blindpool/tree/master/blindpool-frontend


Solution

  • April 11, 2023 release introduced a breaking change to Nodejs Apps

    For all the services using the Node.js runtime, npm run build now automatically runs during deployment if you have the npm build script defined in your package.json file.

    If you don't want it to run the build, then add "gcp-build":"" to the scripts part/section of your package.json file