Open immber opened 9 months ago
Hey immber can you share a small reproduction that is similar to your setup.
@kenneth-rosario , I pushed up a little example here: https://github.com/immber/gcf-build-err
I've been following the docs at: https://cloud.google.com/functions/docs/writing/specifying-dependencies-nodejs#build_your_function_with_vendored_dependencies
The example is just exporting a string to reproduce the error, but my actual use case is that I'm including a /dist
folder that is built by a nested dependency which I'm including at root inside my local source.
I'd love to be able to deploy directly with glcoud function deploy
but instead I'm having to build the docker container manually with pack
then push that to artifact registry, and then deploy a new revision from CloudRun.
@immber Thanks for the reproduction. Will try this out!
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
andpackage.json
is referencing something like"app-common": "file:./localpath"
builds fail and throw the following build error:Was expecting this should work:
But I was able to work around by building a docker image locally and manually pushing:
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.