GoogleCloudPlatform / GoogleCloudPlatform/functions-framework-nodejs

Build error when deploying from gcloud cli with local file dependencies

オープン
#591 コメント 3 件 リアクション 1 件 担当者 0 名 GitHub で見る
gcf bug P2
主要言語
TypeScript
スター
1.4k
フォーク
181
PR マージ指標
30日以内にマージされた PR はありません

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず、ローカルファイル依存関係を含む package.json と、示されている gcloud functions deploy コマンドを使って失敗を再現し、次に動作する pack build の呼び出しと比較します。エントリポイント create を使用して、GOOGLE_VENDOR_NPM_DEPENDENCIES=true とローカル依存関係のビルドパスを追跡します。ローカルソースから依存関係を含めてデプロイに成功し、nil ポインターによるビルドエラーが回帰テストでカバーされれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
docker, google-cloud, nodejs
領域
backend, build-system, cli, cloud
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。