[lambda] Support inline lambda code for Node 10.x
See original GitHub issueCDK doesn’t support ZipFile inline lambda code for NODEJS10. It does support it for NodeJs 8, but when the code below uses NodeJs10, CDK returns an error message saying 10 is incompatible.
I have checked this with AWS Support. They’re not familiar with the CDK, but doing the same thing in pure CloudFormation works with both 8 and 10
Reproduction Steps
// This lambda builds the AMI we later will need to start our EC2 instances
// from. NB that we MUST use InlineCode as the ZipFile format is required
// for the callback signal from cfnresponse.send to work. So no S3 here.
const lambdaProvider = new lambda.SingletonFunction(this, 'AmiBuilderLambda', {
uuid: 'xxxxxxxxxx-xxxxx-xxxx-xxxxxxx-xxxxx',
runtime: lambda.Runtime.NODEJS_8_10, // MUST NOT be NODEJS 10
code: new lambda.InlineCode(fs.readFileSync(`${sourcePath}/index.js`, { encoding: 'utf-8' })),
handler: 'index.handler',
timeout: cdk.Duration.minutes(15),
environment: {
...
},
})
Environment
- **CLI Version :1.16.208
- **Framework Version:1.13.1
- **OS :MacOS
- **Language :TS
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Building Lambda functions with Node.js - AWS Documentation
You can run JavaScript code with Node.js in AWS Lambda. Lambda provides runtimes for Node.js that run your code to process events. Your...
Read more >How to create lambda function with nodejs from ... - AWS re:Post
I am new to lambda and node-js and want to create a CF template to create a lambda function inline without passing the...
Read more >AWS Lambda Now Has Support for Node.js 16 Runtime - InfoQ
Developers can now author AWS Lambda functions using Node.js' new features, such as toolchain and compiler upgrades (including prebuilt binaries ...
Read more >How to dynamically create an inline Lambda with AWS SDK ...
I think aws-cdk is a pretty good option. It generates cloudformation from javascript or typescript and keeps the lines of coding down to...
Read more >AWS Lambda inlined - Binx
The disdvantages of linining lambda code are no custom library support, 4000 character limit and only available for Python and NodeJS. by Dennis ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey @PeterBengtson,
According to aws-cloudformation-coverage-roadmap#80,
ZipFile
support for Node 10 should be coming soon.I could check to make sure, but I doubt they would have rolled out this feature silently.
Hope this helps!
Any ETA?