-
Notifications
You must be signed in to change notification settings - Fork 417
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
Need to bundle specific gRPC binary with Lambda function using serverless webpack #342
Comments
Hi @pflugs30 , thanks for asking. Yes, that is indeed a special setup, especially that you need to package something that is foreign to the build architecture. |
After thinking again, I doubt that the script approach will work at all, because currently the webpack plugin does not allow for custom scripts to be executed while packaging the functions/service. However, with the new packager implementation, it would be possible to implement that as a new feature. I'll create a separate task for that and link this issue. |
Thanks for the response, @HyperBrain. If there's anything I can do to help or test, please let me know. It appears that I may be stuck on my project until this is done. For those who may find there way here via Google, here are things I've tried that have NOT worked:
If anyone has other ideas, I'm all ears! :-) Thanks. |
@pflugs30 Working on a fix right now. I think I'll have a PR ready soon, so that you can test if it solves the problem. |
PR is available. Use |
Thank you very much, @HyperBrain. I am beginning to test it right now, and I will get back to you ASAP. Thank you for your incredibly prompt response. |
Closed with the resolution of Issue #344. |
Released with 5.1.0 |
Further comment for future Googlers (including myself)... I now am using nvm for Windows to dynamically switch between versions of Node and NPM. I am also now designing for NodeJS v8.10 since AWS Lambdas now support it. As such, when I redeployed my Lambda function, I encountered the following error:
I realized I was still building the gprc for NodeJS v6.10. As such, I had to change the The corrected command in the Here is the resulting section of the
|
I'm trying to use the serverless framework to build a Lambda function that pulls messages from Google PubSub. When using the PubSub NodeJS package, one of the dependencies is gRPC which requires that a binary file be downloaded during the install process. Since I'm on a windows laptop for dev, the gRPC install script downloads node-v48-win32-x64-unknown. However, Lambda runs on Linux, and it expects build node-v48-linux-x64-glibc. Per this comment, it is possible to force npm to rebuild the gRPC package to include the Linxu binary.
My problem is that I can't figure out how to include that in the serverless deployment. When serverless webpack bundles everything up, it includes gRPC with the windows version. When this whole package is successfully deployed to AWS, the Lambda function throws the following error:
So my question is: how can I insert the package rebuild command as part of the serverless-webpack process so the correct version of the gRPC binary gets sent to AWS? It's as if the serverless-webpack is doing a full
npm install
, and I'd like to insert after that is done to rebuild the gRPC module. I understand that this is a complicated situation and question, and I'm happy to provide any other information.Serverless.yaml
webpack.config.js
The text was updated successfully, but these errors were encountered: