Closed
Description
Expected Behaviour
ESM Lambda function with Tracer enabled should be invoked without error
Current Behaviour
Lambda invocation error received:
{
"errorType": "Error",
"errorMessage": "Dynamic require of \"util\" is not supported",
"trace": [
"Error: Dynamic require of \"util\" is not supported",
" at file:///var/task/index.mjs:1:382",
" at <anonymous> (/node_modules/cls-hooked/context.js:4:14)",
" at file:///var/task/index.mjs:1:458",
" at <anonymous> (/node_modules/aws-xray-sdk-core/dist/lib/context_utils.js:5:11)",
" at file:///var/task/index.mjs:1:458",
" at <anonymous> (/node_modules/aws-xray-sdk-core/dist/lib/aws-xray.js:2:20)",
" at file:///var/task/index.mjs:1:458",
" at <anonymous> (/node_modules/aws-xray-sdk-core/dist/lib/index.js:3:18)",
" at file:///var/task/index.mjs:1:458",
" at <anonymous> (/node_modules/@aws-lambda-powertools/tracer/lib/esm/provider/ProviderService.js:1:21)"
]
}
Code snippet
Lambda function with following configuration in CDK app (some options removed for brevity):
new NodejsFunction(this, "MyFunction", {
architecture: Architecture.ARM_64,
bundling: {
format: OutputFormat.ESM,
},
runtime: Runtime.NODEJS_20_X,
tracing: Tracing.ACTIVE,
})
Steps to Reproduce
- Deploy an ESM Lambda function with Tracer
- Invoke function
- Observe error
Possible Solution
No response
Powertools for AWS Lambda (TypeScript) version
latest
AWS Lambda function runtime
20.x
Packaging format used
npm
Execution logs
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Shipped