Open dreamorosi opened 1 week ago
Findings:
Reproducible in CDK CLI/Lib version 2.147.1 (build d3695d4)
. If we use the default CDK app settings without env
property while creating stack,
cdk.out/<<StackName>>.template.json
with Mappings::LatestNodeRuntimeMap
node with missing entry for ca-west-1
region.
❌ Issue30694Stack failed: Error [ValidationError]: Template error: Unable to get mapping for LatestNodeRuntimeMap::ca-west-1::value
at Request.extractError (/Users/ashdhin/dev/repros/cdk/issue30694/node_modules/aws-cdk/lib/index.js:401:46723)
at Request.callListeners (/Users/ashdhin/dev/repros/cdk/issue30694/node_modules/aws-cdk/lib/index.js:401:91777)
at Request.emit (/Users/ashdhin/dev/repros/cdk/issue30694/node_modules/aws-cdk/lib/index.js:401:91225)
at Request.emit (/Users/ashdhin/dev/repros/cdk/issue30694/node_modules/aws-cdk/lib/index.js:401:199828)
at Request.transition (/Users/ashdhin/dev/repros/cdk/issue30694/node_modules/aws-cdk/lib/index.js:401:193380)
at AcceptorStateMachine.runTo (/Users/ashdhin/dev/repros/cdk/issue30694/node_modules/aws-cdk/lib/index.js:401:158252)
at /Users/ashdhin/dev/repros/cdk/issue30694/node_modules/aws-cdk/lib/index.js:401:158582
at Request.<anonymous> (/Users/ashdhin/dev/repros/cdk/issue30694/node_modules/aws-cdk/lib/index.js:401:193672)
at Request.<anonymous> (/Users/ashdhin/dev/repros/cdk/issue30694/node_modules/aws-cdk/lib/index.js:401:199903)
at Request.callListeners (/Users/ashdhin/dev/repros/cdk/issue30694/node_modules/aws-cdk/lib/index.js:401:91945) {
code: 'ValidationError',
time: 2024-06-27T20:29:50.742Z,
requestId: '739abc90-9dc3-4d69-8435-61e8b5bb243a',
statusCode: 400,
retryable: false,
retryDelay: 144.327793178868
}
❌ Deployment failed: Error [ValidationError]: Template error: Unable to get mapping for LatestNodeRuntimeMap::ca-west-1::value
at Request.extractError (/Users/ashdhin/dev/repros/cdk/issue30694/node_modules/aws-cdk/lib/index.js:401:46723)
at Request.callListeners (/Users/ashdhin/dev/repros/cdk/issue30694/node_modules/aws-cdk/lib/index.js:401:91777)
at Request.emit (/Users/ashdhin/dev/repros/cdk/issue30694/node_modules/aws-cdk/lib/index.js:401:91225)
at Request.emit (/Users/ashdhin/dev/repros/cdk/issue30694/node_modules/aws-cdk/lib/index.js:401:199828)
at Request.transition (/Users/ashdhin/dev/repros/cdk/issue30694/node_modules/aws-cdk/lib/index.js:401:193380)
at AcceptorStateMachine.runTo (/Users/ashdhin/dev/repros/cdk/issue30694/node_modules/aws-cdk/lib/index.js:401:158252)
at /Users/ashdhin/dev/repros/cdk/issue30694/node_modules/aws-cdk/lib/index.js:401:158582
at Request.
Template error: Unable to get mapping for LatestNodeRuntimeMap::ca-west-1::value
env
property during CDK stack creation in CDK app, it does not create Mappings::LatestNodeRuntimeMap
node in cdk.out/<<StackName>>.template.json
and deployment succeeds.
Describe the bug
From 2.146.0 onwards, cdk vended custom resources are now region aware - this change seems to have been introduced in #30108.
To my understanding this means that when deploying a cdk vended custom resource, the
LATEST_NODE_RUNTIME_MAP
is used to lookup the Node.js version to use in the underlying Lambda function.This in turn appears to look up the regions in the
AWS_REGIONS_AND_RULES
map in thepackages/aws-cdk-lib/region-info/lib/aws-entities.ts
file - which is missing an AWS region (ca-west-1
).Expected Behavior
I should be able to deploy a CDK stack that uses cdk-vended custom resources in this region.
Current Behavior
When deploying in
ca-west-1
, the stack fails due to the missing region in theMapping
node of the generated CloudFormation stack:Reproduction Steps
npx aws-cdk@latest init app --language typescript
lib/test-stack.ts
This will generate a cdk vended custom resource because of the
logRetention
prop.npm run cdk synth
to generate the CloudFormation stack filecdk.out/TestStack.template.json
and find theMappings.LatestNodeRuntimeMap
ca-west-1
region is missing from the mappingca-west-1
viaexport AWS_REGION=ca-west-1
Possible Solution
No response
Additional Information/Context
My team Powertools for AWS Lambda deploys Lambda layers in all regions, including the missing one.
We discovered the issue in our canaries which were now failing to deploy in
ca-west-1
. Downgrading to 2.145.0 fixed the issue.CDK CLI Version
2.146.0
Framework Version
No response
Node.js Version
20.x
OS
Linux, Mac
Language
TypeScript
Language Version
No response
Other information
No response