GoogleCloudPlatform / GoogleCloudPlatform/functions-framework-nodejs

Build error when deploying from gcloud cli with local file dependencies

Đang mở
#591 3 bình luận 1 reaction 0 người được giao Xem trên GitHub
gcf bug P2
Ngôn ngữ chính
TypeScript
Star
1.4k
Fork
181
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện lỗi với package.json chứa một dependency tệp cục bộ và lệnh gcloud functions deploy được示, sau đó so sánh với invocation pack build đang hoạt động. Theo dõi đường dẫn build cho GOOGLE_VENDOR_NPM_DEPENDENCIES=true và dependency cục bộ, sử dụng entry point create. Công việc được xem là hoàn tất khi việc deployment từ mã nguồn cục bộ thành công với các dependency được bao gồm và lỗi build do con trỏ nil được bao phủ bởi một regression test.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
docker, google-cloud, nodejs
Lĩnh vực
backend, build-system, cli, cloud
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.