Skip to content

AwsLambdaReceiver is incompatible with AWS Lambda Node.js 24 runtime (callback handlers deprecated) #2761

@HAKASHUN

Description

@HAKASHUN

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    TypeScript-specificauto-triage-skipPrevent this issue from being closed due to lack of activitybugM-T: confirmed bug report. Issues are confirmed when the reproduction steps are documenteddependenciesPull requests that update a dependency filesemver:patch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions