question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[lambda] Support inline lambda code for Node 10.x

See original GitHub issue

CDK 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:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
nmussycommented, Oct 23, 2019

Hey @PeterBengtson,

According to aws-cloudformation-coverage-roadmap#80, ZipFile support for Node 10 should be coming soon.

pure CloudFormation works with both 8 and 10

I could check to make sure, but I doubt they would have rolled out this feature silently.

Hope this helps!

0reactions
PeterBengtsoncommented, Oct 26, 2019

Any ETA?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found