google-github-actions / deploy-appengine

A GitHub Action that deploys source code to Google App Engine.
https://cloud.google.com/appengine
254 stars 72 forks source link

gcloud app deploy failed #326

Closed sebastianbuechler closed 1 year ago

sebastianbuechler commented 1 year ago

TL;DR

I wanted to deploy with this github action after a couple months working perfectly fine, now I get the error that Could not determine Node.js install directory

Expected behavior

Deploy my app as usual.

Observed behavior

Deploy throws an error and github actions breaks.

Action YAML

name: Deploy (Production)

on:
  release:
    types: [created]

jobs:
  deploy:
    name: Deploy to Google Cloud
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - id: "auth"
        uses: "google-github-actions/auth@v1"
        with:
          credentials_json: "${{ secrets.SA_KEY }}"

      - id: "deploy"
        uses: "google-github-actions/deploy-appengine@v1"

Log output

Deploy to Google Cloud
google-github-actions/deploy-appengine failed with: failed to execute gcloud command `gcloud app deploy --quiet --format json app.yaml --promote`: Services to deploy:

descriptor:                  [/home/runner/work/project/app.yaml]
source:                      [/home/runner/work/project]
target project:              [target-project]
target service:              [default]
target version:              [target-version]
target url:                  [target-url]
target service account:      [target-service-account]

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 {uuid} status: FAILURE
node:internal/modules/cjs/loader:1029
  throw err;
  ^

Cannot find module '/layers/google.nodejs.runtime/node/bin/node_modules/npm/bin/npm-cli.js'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1026:15)
    at Function.Module._load (node:internal/modules/cjs/loader:871:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:22:47 ***
  code: 'MODULE_NOT_FOUND',
  requireStack: []
***
Could not determine Node.js install directory

Additional information

No response

sebastianbuechler commented 1 year ago

Apparently this is a GCP issue when specifying an npm version in the package.json file: https://github.com/GoogleCloudPlatform/buildpacks/issues/311