googlearchive / cloud-functions-go

Unofficial Native Go Runtime for Google Cloud Functions
Apache License 2.0
423 stars 44 forks source link

Deployment issues #43

Open ncruces opened 5 years ago

ncruces commented 5 years ago

I've had two different issues with deployment I've since worked around. Leaving this here for documentation, maybe it'll help others.

ncruces commented 5 years ago

First issue. Deploying with the Node 8 Beta runtime gives the following error:

Build failed: USER ERROR:
`npm_install` had stderr output:
npm ERR! code ENOLOCAL
npm ERR! Could not install from "local_modules/execer" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in:
npm ERR!     /builder/home/.npm/_logs/2018-10-18T12_01_06_969Z-debug.log

error: `npm_install` returned code: 1

This can be fixed by changing the Makefile here to deploy local_modules instead of node_modules. Any ideas why?

With that change everything seems to work just fine. worker.js now lives at /worker/worker.js, but everything seems consistent with the nodego implemetation.

ncruces commented 5 years ago

Second issue is somewhat related, but was harder to pinpoint. Same issue as #37. Gets stuck in deployment, takes a few minutes to timeout.

The hint that you're having this problem is in this comment. You'll have this in your package-lock.json diff:

-      "version": "file:local_modules/execer"
+      "version": "file://local_modules/execer"

It seems to have something to do with the node version used to build the project. I was having this with the default version shipped with Ubuntu LTS 18.04. Fixed it by using the same node/npm version as GCF (6.14.0 and 8.11.1).

iangudger commented 5 years ago

Feel free to send pull requests.

Also check this out: https://medium.com/google-cloud/google-cloud-functions-for-go-57e4af9b10da

ncruces commented 5 years ago

Regarding the medium post, I had already applied. Waiting eagerly for access.

As far as PRs, the only reason I didn't submit one yet is that I'm unsure whether "works-for-me" works for everybody else.

Specifically, does deploying local_modules instead of node_modules make sense? I think when I tested it it fixed things for Node 8, but broke Node 6. I'm not 100% positive about that, though.

Also, I'm also not using the test server as is, and I'm afraid of breaking it for others.

BTW, Node 6 works fine and is the only one covered by an SLA. The only reason I'm using Node 8 Beta is that I'm running a binary (LibreOffice's soffice) that depends on libs that (almost "by accident") are only available on the Node 8 runtime.

Thanks!

iangudger commented 5 years ago

Regarding the medium post, I had already applied. Waiting eagerly for access.

Message me directly and I will see if I can help.

As far as PRs, the only reason I didn't submit one yet is that I'm unsure whether "works-for-me" works for everybody else.

Specifically, does deploying local_modules instead of node_modules make sense? I think when I tested it it fixed things for Node 8, but broke Node 6. I'm not 100% positive about that, though.

Would it be possible to support both some how? Maybe we could have two versions or something?

Also, I'm also not using the test server as is, and I'm afraid of breaking it for others.

I can test with the test server.

BTW, Node 6 works fine and is the only one covered by an SLA. The only reason I'm using Node 8 Beta is that I'm running a binary (LibreOffice's soffice) that depends on libs that (almost "by accident") are only available on the Node 8 runtime.

I don't think this is covered by the SLA regardless of the base runtime :)

Can you provide a list of missing dependencies? I can ask about adding them to the Node 6 image.

ncruces commented 5 years ago

Reviewing this again the change (deploying local_modules) works with Node 6 as well. So I have a PR with that change.

Regarding the SLA, this obviously isn't covered (I didn't mean to imply that it was). But my impression is that being out of beta with an SLA makes it less likely that things like shared libraries and other installed software will change without prior notice. The Node 8 runtime can silently drop the additional libraries I need without even a redeploy, and that's OK: it's a beta. I have to live with that.

I'll try to list the missing dependencies on Node 6, but I imagine they are extensive.

ncruces commented 5 years ago

Missing libs for LibreOffice soffice.bin in the Node 6 runtime (as reported by ldd):

        libICE.so.6 => not found
        libSM.so.6 => not found
        libXrender.so.1 => not found
        libnspr4.so => not found
        libnss3.so => not found
        libnssutil3.so => not found
        libplc4.so => not found
        libplds4.so => not found
        libsmime3.so => not found
        libssl3.so => not found
        libxcb-render.so.0 => not found
        libxcb-shm.so.0 => not found
        libxslt.so.1 => not found

I'm using headless LibreOffice to convert Office documents to PDF/HTML, and then Go to post-process some of those HTML files. JS was way too slow to post-process the larger HTML files. Initially, I ran Go out-of-process, now I'm trying to use Go for everything.

iangudger commented 5 years ago

No promises, but I have reported the missing libraries issue in the Node 6 runtime to the team.

ncruces commented 5 years ago

Alas, seems the team went the other way and removed some of those libraries (libssl3) from the Node 8 beta runtime.

😔

Tracking here: https://issuetracker.google.com/issues/118423830