aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.69k stars 3.93k forks source link

aws-cdk/aws-s3/lib/notifications-resource/notifications-resource-handler.ts: Migrate to lambda Nodejs14x #16364

Closed SukanyaHanumanthu closed 3 years ago

SukanyaHanumanthu commented 3 years ago

Overview:

Hi Team,

Could you migrate your lambda functions by Sept 17th tonodejs14.x as nodejs10.x is planned for deprecation?

This is a đź“ŠTracking Issue

otaviomacedo commented 3 years ago

As we discussed offline, version 1.66.0 of the CDK is very old now. If customers use the latest version, they won't have this problem.

github-actions[bot] commented 3 years ago

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

ralph-success commented 3 years ago

@otaviomacedo I'm not sure if this helps but I do see a similar message as @SukanyaHanumanthu reported.

This was today on AMAZON LINUX. 11/19/2021

I changed line 55 from nodejs10 to nodejs14

and cdk deploy worked. BEFORE it failed with the nodejs10 error message.

 48         const resource = new InLineLambda(this, 'Resource', {
 49             type: resourceType,
 50             properties: {
 51                 Description: 'AWS CloudFormation handler for "Custom::S3BucketNotifications" resources (@aws-cdk/aws-s3)',
 52                 Code: { ZipFile: `exports.handler = ${handler.toString()};` },
 53                 Handler: 'index.handler',
 54                 Role: role.roleArn,
 55                 Runtime: 'nodejs14.x',
 56                 Timeout: 300,
 57             }
 58         });
 59         resource.node.addDependency(role);
 60         this.functionArn = resource.getAtt('Arn').toString();
 61     }
 62     /**
 63      * Defines a stack-singleton lambda function with the logic for a CloudFormation custom
 64      * resource that provisions bucket notification configuration for a bucket.
 65      *
 66      * @returns The ARN of the custom resource lambda function.
 67      */
 68     static singleton(context) {
 69         const root = cdk.Stack.of(context);
 70         // well-known logical id to ensure stack singletonity
 71         const logicalId = 'BucketNotificationsHandler050a0587b7544547bf325f094a3db834';
"../textract-pipeline/node_modules/@aws-cdk/aws-s3/lib/notifications-resource/notifications-resource-handler.js" 153 lines --35%--         55,17         32%