-
Notifications
You must be signed in to change notification settings - Fork 420
Description
Summary
When running a Bolt app on AWS Lambda with the Node.js 24 runtime, functions exported via AwsLambdaReceiver.toHandler() fail at startup with the following error:
Runtime.CallbackHandlerDeprecated
This appears to be related to the fact that the Node.js 24 Lambda runtime no longer supports callback-style handlers.
Environment
- @slack/bolt: 4.6.0
- AWS Lambda runtime: Node.js 24
- Deployment: API Gateway → Lambda
- Receiver: AwsLambdaReceiver
Observed behavior
AwsLambdaReceiver.toHandler() currently returns a handler typed as:
(event, context, callback) => Promise<AwsResponse>When this function is exported directly as the Lambda entry point, the runtime fails before invocation on Node.js 24 with Runtime.CallbackHandlerDeprecated.
This does not occur on earlier Lambda runtimes (e.g. Node.js 18 / 20).
Expected behavior
Bolt applications using AwsLambdaReceiver should be able to run on the Node.js 24 Lambda runtime without requiring callback-style handlers.
A promise-based handler signature such as:
(event, context) => Promise<AwsResponse>Workaround
As a temporary solution, we wrapped the handler and exported a 2-argument async
function:
const boltHandler = receiver.toHandler();
export const handler = async (event, context) => {
// @ts-expect-error Node.js 24 Lambda does not support callback-style handlers
return boltHandler(event, context);
};This resolves the runtime error, but requires suppressing a TypeScript type mismatch because the current Bolt typings still expect a callback parameter.
It may be helpful to update AwsLambdaReceiver.toHandler() (and its typings) to support promise-based Lambda handlers, ensuring compatibility with the Node.js 24 runtime.
We’re happy to provide additional details or test changes if that’s useful.
Requirements
Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.