duo-labs / cloudmapper

CloudMapper helps you analyze your Amazon Web Services (AWS) environments.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CDK v.1.71.0 install fails due to deprecated nodejs10.x runtime

ejohn20 opened this issue · comments

Running the - cdk deploy --require-approval never command fails on install due to the nodejs10.x runtime being referenced.

Relevant stack trace:

CloudmapperauditorStack \| 21/32 \| 3:08:34 PM \| CREATE_IN_PROGRESS   \| AWS::Lambda::Function                 \| alarm_forwarder (alarmforwarder33AB7BCE) Resource creation Initiated
--
845 | CloudmapperauditorStack \| 22/32 \| 3:08:35 PM \| CREATE_COMPLETE      \| AWS::Lambda::Function                 \| alarm_forwarder (alarmforwarder33AB7BCE)
846 | CloudmapperauditorStack \| 22/32 \| 3:08:35 PM \| CREATE_IN_PROGRESS   \| AWS::Lambda::Function                 \| LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8a (LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aFD4BFC8A) Resource creation Initiated
847 | CloudmapperauditorStack \| 22/32 \| 3:08:35 PM \| CREATE_FAILED        \| AWS::Lambda::Function                 \| LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8a (LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aFD4BFC8A) Resource handler returned message: "The runtime parameter of nodejs10.x is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (nodejs14.x) while creating or updating functions. (Service: Lambda, Status Code: 400, Request ID: d29c80ad-c3d4-447b-988d-89d1931f3708, Extended Request ID: null)" (RequestToken: b980fba3-10a8-4924-6874-7c2e30119a0f, HandlerErrorCode: InvalidRequest)
848 | new LogRetentionFunction (/codebuild/output/src948579607/src/cloudmapper/auditor/node_modules/@aws-cdk/aws-logs/lib/log-retention.ts:153:22)
849 | \_ LogRetention.ensureSingletonLogRetentionFunction (/codebuild/output/src948579607/src/cloudmapper/auditor/node_modules/@aws-cdk/aws-logs/lib/log-retention.ts:120:12)
850 | \_ new LogRetention (/codebuild/output/src948579607/src/cloudmapper/auditor/node_modules/@aws-cdk/aws-logs/lib/log-retention.ts:79:27)
851 | \_ new Function (/codebuild/output/src948579607/src/cloudmapper/auditor/node_modules/@aws-cdk/aws-lambda/lib/function.ts:637:28)
852 | \_ new CloudmapperauditorStack (/codebuild/output/src948579607/src/cloudmapper/auditor/lib/cloudmapperauditor-stack.js:164:29)
853 | \_ Object.<anonymous> (/codebuild/output/src948579607/src/cloudmapper/auditor/bin/cloudmapperauditor.js:9:1)
854 | \_ Module._compile (internal/modules/cjs/loader.js:1158:30)
855 | \_ Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
856 | \_ Module.load (internal/modules/cjs/loader.js:1002:32)
857 | \_ Function.Module._load (internal/modules/cjs/loader.js:901:14)
858 | \_ Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
859 | \_ internal/main/run_main_module.js:18:47

It appears that the CDK custom resources were all upgraded to node12 in v1.84.0 (aws/aws-cdk@29c4943#diff-5670d7468123451376c8589018eaef274d1e20c75c1e93e13daee59c7bd4ad1e), and then again to node14 in v1.111.0 (aws/aws-cdk@1eb6de7#diff-5670d7468123451376c8589018eaef274d1e20c75c1e93e13daee59c7bd4ad1e).

Upgrading to the current 1.x version (v1.132.0) seems to address the issue and install cleanly.

--- a/auditor/package.json
+++ b/auditor/package.json
@@ -11,18 +11,18 @@
   },
   "devDependencies": {
     "@types/node": "8.10.45",
-    "aws-cdk": "^1.71.0",
+    "aws-cdk": "^1.132.0",
     "typescript": "^3.9.7"
   },
   "dependencies": {
-    "@aws-cdk/aws-cloudwatch-actions": "^1.71.0",
-    "@aws-cdk/aws-ec2": "^1.71.0",
-    "@aws-cdk/aws-ecs": "^1.71.0",
-    "@aws-cdk/aws-ecs-patterns": "^1.71.0",
-    "@aws-cdk/aws-events": "^1.71.0",
-    "@aws-cdk/aws-logs": "^1.71.0",
-    "@aws-cdk/aws-s3": "^1.71.0",
-    "@aws-cdk/core": "^1.71.0",
+    "@aws-cdk/aws-cloudwatch-actions": "^1.132.0",
+    "@aws-cdk/aws-ec2": "^1.132.0",
+    "@aws-cdk/aws-ecs": "^1.132.0",
+    "@aws-cdk/aws-ecs-patterns": "^1.132.0",
+    "@aws-cdk/aws-events": "^1.132.0",
+    "@aws-cdk/aws-logs": "^1.132.0",
+    "@aws-cdk/aws-s3": "^1.132.0",
+    "@aws-cdk/core": "^1.132.0",
     "js-yaml": "^3.14.0",
     "source-map-support": "^0.5.19"
   }

Happy to submit a PR for this if that helps.

@ejohn20 - I'm running into the same issue... would be great if you could open a PR for this - thanks!

@matt-f-tsu - PR submitted.

I merged the PR. Thank you @ejohn20 so I'm closing this now.

Follow up oddity. If you try to deploy this using CDK CLI 1.132.0, it will fail with this message:

This CDK CLI is not compatible with the CDK library used by your application. Please upgrade the CLI to the latest version. (Cloud assembly schema version mismatch: Maximum schema version supported is 14.0.0, but found 15.0.0)

Upgrading the aws-cdk package to v1.134.0 will allow the cdk deploy --require-approval never command to run successfully.

npm install -g aws-cdk@1.134.0

Perhaps, upgrading to v1.134.0 across the board would be a more consistent solution.