Skip to content
This repository was archived by the owner on Apr 5, 2025. It is now read-only.

Commit 96406ab

Browse files
Merge pull request #46 from awslabs/rf/force-empty-architectures
2 parents 489152c + d4530a9 commit 96406ab

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/lambda-powertools-layer.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,13 @@ export class LambdaPowertoolsLayer extends lambda.LayerVersion {
9999
layerVersionName: props?.layerVersionName ? props?.layerVersionName : undefined,
100100
license: 'MIT-0',
101101
compatibleRuntimes: getRuntimesFromRuntimeFamily(runtimeFamily),
102-
compatibleArchitectures,
103102
description: `Lambda Powertools for ${languageName} [${compatibleArchitecturesDescription}]${
104103
props?.includeExtras ? ' with extra dependencies' : ''
105104
} ${props?.version ? `version ${props?.version}` : 'latest version'}`.trim(),
105+
// Dear reader: I'm happy that you've stumbled upon this line too! You might wonder, why are we doing this and passing `undefined` when the list is empty?
106+
// Answer: on regions that don't support ARM64 Lambdas, we can't use the `compatibleArchitectures` parameter. Otherwise CloudFormation will bail with an error.
107+
// So if this construct is called with en empty list of architectures, just pass undefined down to the CDK construct.
108+
compatibleArchitectures: compatibleArchitectures.length == 0 ? undefined : compatibleArchitectures,
106109
});
107110
}
108111
}

0 commit comments

Comments
 (0)