GoogleCloudPlatform / GoogleCloudPlatform/functions-framework-nodejs

Build error when deploying from gcloud cli with local file dependencies

Offen
#591 3 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
gcf bug P2
Vorherrschende Sprache
TypeScript
Sterne
1.4k
Forks
181
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Deploying from local source with `gcloud functions deploy` seems unable to include local file dependencies.

When setting `--set-build-env-vars GOOGLE_VENDOR_NPM_DEPENDENCIES=true` and `package.json` is referencing something like `"app-common": "file:./localpath"` builds fail and throw the following build error:
```
"Step #2 - "build": panic: runtime error: invalid memory address or nil pointer dereference"
```

Was expecting this should work:
```
gcloud functions deploy my-function \
--entry-point=create \
--trigger-http \
--set-build-env-vars GOOGLE_VENDOR_NPM_DEPENDENCIES=true
```

But I was able to work around by building a docker image locally and manually pushing:

```
pack build \
--builder gcr.io/buildpacks/builder:v1 \
--env GOOGLE_FUNCTION_SIGNATURE_TYPE=http \
--env GOOGLE_FUNCTION_TARGET=create \
--env GOOGLE_VENDOR_NPM_DEPENDENCIES=true \
my-function
```

If I try the `gcloud functions deploy` command minus the build env var, it pushes an image to the cloud function that is missing dependencies. It would be great if this could deploy from local source in one step and have it correctly include dependencies, instead of manually having to build a docker image and push.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.