Closed
Description
Expected Behaviour
CDK Example found at examples/cdk/README.md
functions as described
Current Behaviour
Deployment succeeds, however invocation of the API Gateway URL produces an Internal Error.
Looking at the Lambda functions logs it produces:
{
"errorType": "Runtime.ImportModuleError",
"errorMessage": "Error: Cannot find module '@aws-lambda-powertools/parameters/ssm'\nRequire stack:\n- /var/task/index.js\n- /var/runtime/index.mjs",
"stack": [
"Runtime.ImportModuleError: Error: Cannot find module '@aws-lambda-powertools/parameters/ssm'",
"Require stack:",
"- /var/task/index.js",
"- /var/runtime/index.mjs",
" at _loadUserApp (file:///var/runtime/index.mjs:1087:17)",
" at async UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1119:21)",
" at async start (file:///var/runtime/index.mjs:1282:23)",
" at async file:///var/runtime/index.mjs:1288:1"
]
}
Code snippet
Follow instructions: examples/cdk/README.md
Steps to Reproduce
Follow instructions: examples/cdk/README.md
Possible Solution
Looking at examples/cdk/src/example-stack.ts
- Runtime of NodeJS 20 is specified as a default:
const commonProps: Partial<NodejsFunctionProps> = {
runtime: Runtime.NODEJS_20_X,
tracing: Tracing.ACTIVE,
...
However version :18 of the Lambda Layer is specified:
commonProps.layers?.push(
LayerVersion.fromLayerVersionArn(
this,
'powertools-layer',
`arn:aws:lambda:${
Stack.of(this).region
}:094274105915:layer:AWSLambdaPowertoolsTypeScript:18`
)
);
Viewing the Layer configuration in the Lambda console shows that NodeJS 20 is not supported. Support Runtimes for that layer version are:
Powertools for AWS Lambda (TypeScript) version
latest
AWS Lambda function runtime
20.x
Packaging format used
Lambda Layers
Execution logs
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Shipped