GoogleCloudPlatform / GoogleCloudPlatform/functions-framework-nodejs
Build error when deploying from gcloud cli with local file dependencies
- 主要语言
- 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