I am using Docker Engine 18.0.09.1 with the Serverless CLI to package and deploy AWS Lambda CRUD functions. The deployment succeeds in uploading the necessary modules, creates all the Lambda functions, and builds out the CloudFormation. I verified all the node_modules installed within the Docker /lambda-project directory are present in the S3 directory to which the deployment was directed.
Unfortunately, when I test the create function, or any function, I receive this error:
“/var/lang/bin/…/lib/libstdc++.so.6: version `GLIBCXX_3.4.21’ not found (required by /var/task/node_modules/couchbase/build/Release/couchbase_impl.node)”
This is an amazonlinux Docker image. I have tried all the usual junk to install from sudo apt-get, yum install, etc, none of those are recognized. I am at a loss.
Hello,
I’m answering now (a bit late…) as I had the same issue recently and did not find any answer.
The problem is that lambda environment does not have the right version of this lib.
What you need is to get a latest version of this lib (on amazonlinux2, I did a yum update libstdc++ and copied it from /usr/lib64).
You then need to create a lib folder at the root of your code and place it there (I use the zip functionality directly within lambda, not serverless cli).
Any library not found by lambda will be searched there!
I am facing same issue. In my /usr/lib64. I could find two files ’ libstdc++.so.6.0.24’ and ‘libstdc++.so.6’. I have copy this two file in my project my-service/lib/{copy this two files}.
bash-4.2# serverless invoke -f hello
{
“errorMessage”: “/var/lang/bin/…/lib/libstdc++.so.6: version `GLIBCXX_3.4.21’ not found (required by /var/task/node_modules/couchbase/build/Release/couchbase_impl.node)”,
“errorType”: “Error”,
“stackTrace”: [
“Module.load (module.js:565:32)”,
“tryModuleLoad (module.js:505:12)”,
“Function.Module._load (module.js:497:3)”,
“Module.require (module.js:596:17)”,
“require (internal/module.js:11:18)”,
“bindings (/var/task/node_modules/bindings/bindings.js:84:48)”,
“Object. (/var/task/node_modules/couchbase/lib/binding.js:213:36)”,
“Module._compile (module.js:652:30)”,
“Object.Module._extensions…js (module.js:663:10)”
]
}
I’m not sure if serverless cli works the same, but I expect it should.
I did also copy those 2 files ti my-service/lib , plus the one called libstdc++.so
On which linux are you ? amazonlinux ? amazonlinux2 ? It should be amazonlinux I think.
I personaly went through different steps, starting from an amazon linux container. But I thought the relevant step was the one I mentioned here. If you wish, I can give you the detailed steps I followed, and you can try that (I did not have time to figure out yet which steps were absolutely necessary and which weren’t).
Hi, sorry for the delay, I did not see your reply.
Here are all the steps I took from a linux ec2. Some of those steps might be redundant, I hadn’t had time to filter out.
Please try this from your lambda directory and let me know if you can compile: