-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible to gcloud functions deploy
when using private GitHub packages?
#258
Comments
Hi. I'm sorry @techieshark, this GitHub repo is not meant to file bugs against Cloud Functions. It's used to track issues directly in this npm module. I don't know of this issue off hand. For looking at the container, I believe you can build the container with Buildpacks and then use dive to inspect it: https://cloud.google.com/functions/docs/building/pack For general support, please use this: |
Hi @grant thanks for the quick response. I'll take a look at the "pack" and "dive" links you shared and see if that helps for debugging. Really appreciate the pointers! For the benefit of others who might land here, I found this open issue in the Google Issue Tracker which would suggest cloud functions doesn't actually support using GitHub package repo: |
Thanks again @grant - the tip to use For the sake of anyone landing here, I'll describe what I did. First, build the cloud functions docker image (replace "myEntryPointFunction" with your entry point)
Then open a shell in it:
Inside the docker image, cd to /workspace and look around. Tip: Node is installed in a funny location (find / -name node turned it up in Strangely, I got a very different error when trying to run the code (vs what I saw in Stackdriver log): (So it turned out the issue was not that the entire module was missing - or that it wasn't installed from GitHub packages - but that I had the wrong file pointed to by the "main" field in the module's package.json.) I hpoe this might help others. Thanks again for the tip! |
Summary
I've been getting an inexplicable error during deployment and I'm unable to debug it.
I have a private monorepo and am publishing individual private packages to it using GitHub Packages. It seems Cloud Build is able to fetch the package ("yarn" works fine) but it seems that package is mysteriously missing when the function actually executes. What am I missing?
Details
I have a
.npmrc
which looks like:In
package.json
, I have:I then have some npm scripts I run to deploy:
When deploying, it seems the build phase works. The private package from the GitHub package repo seems to install - I can verify that by adding a
postinstall
script which just doesls node_modules/@myGithubOrgScopeName/
:Furthermore, I see no issues when viewing the Cloud Build logs via the url shown during the execution of
gcloud functions deploy
:If it helps, here's the build id shown in the legacy logs viewer filter settings:
However, the overall deploy fails ("on loading user code"):
When I go to Stackdriver Logs > Cloud Function > my function, I see that the module which should be from the GitHub package repo is not present (what?? it was there during deploy!).
Finally, I'm not sure how to further debug this, since:
a) The "Download Zip" feature on cloud functions console does not include the
node_modules/
, and alsob) it does include package.json and I can confirm that my desired package is in fact listed as a dependency (contrary to what the logs' suggestion indicates as a potential problem).
Is there a way, via the functions framework, to deploy to a local container I could then inspect? Or any other suggestions for how to fix this or what I might be doing wrong?
Thanks!
The text was updated successfully, but these errors were encountered: