NodeJS wrapper warns that callback-based function handlers will be unsupported in Node 24
I started seeing these warnings when using the OTEL layer:
AWS Lambda plans to remove support for callback-based function handlers starting with Node.js 24. You will need to update this function to use an async handler to use Node.js 24 or later. For more information and to provide feedback on this change, see https://github.com/aws/aws-lambda-nodejs-runtime-interface-client/issues/137. To disable this warning, set the AWS_LAMBDA_NODEJS_DISABLE_CALLBACK_WARNING environment variable.
I'm using layer arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-nodejs-arm64-ver-1-30-1:1. If I remove the layer, the message does not appear.
I'm having the same issue. The documentation specifically calls out to use module.exports.
Ran into the same thing, and found this issue when trying to submit a new one.
Reproduction
-
Create Lambda function with async handler:
export async function handler(event) { console.log('Event:', event) return { statusCode: 200 } } -
Configure ADOT layer in
serverless.yml:functions: myFunction: handler: src/index.handler runtime: nodejs22.x layers: - arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-nodejs-amd64-ver-1-30-0:1 environment: AWS_LAMBDA_EXEC_WRAPPER: /opt/otel-handler -
Deploy and invoke function
-
Check CloudWatch Logs → warning appears despite async handler
Expected Behavior
No callback warning should appear when:
- Handler uses
export async function handler(event)pattern - No callbacks are used in application code
- Handler signature is Node.js 24+ compatible
Current Workaround
Suppress the warning with environment variable:
environment:
AWS_LAMBDA_NODEJS_DISABLE_CALLBACK_WARNING: "1"
This is suboptimal because:
- Masks the intent (code already compatible, not ignoring a real issue)
- Users may think their code needs refactoring
- Warning pollution in logs