Skip to content

Lambda node 24 callback error even on resolutionMode PROMISE #707

@giorgio-zamparelli

Description

@giorgio-zamparelli

Lambda node 24 is throwing callback deprecated error even when using resolutionMode PROMISE.

Node 24 runtime is available for Lambda.
https://aws.amazon.com/blogs/compute/node-js-24-runtime-now-available-in-aws-lambda/

I tried to switch from node 22 to 24 but I'm seeing the error Runtime.CallbackHandlerDeprecated:

{
    "errorType": "Runtime.CallbackHandlerDeprecated",
    "errorMessage": "ERROR: AWS Lambda has removed support for callback-based function handlers starting with Node.js 24. You need to modify this function to use a supported handler signature to use Node.js 24 or later. For more information see https://docs.aws.amazon.com/lambda/latest/dg/nodejs-handler.html.",
    "name": "Runtime.CallbackHandlerDeprecated",
    "stack": [
        "Runtime.CallbackHandlerDeprecated: ERROR: AWS Lambda has removed support for callback-based function handlers starting with Node.js 24. You need to modify this function to use a supported handler signature to use Node.js 24 or later. For more information see https://docs.aws.amazon.com/lambda/latest/dg/nodejs-handler.html.",
        "    at errorOnDeprecatedCallback (file:///var/runtime/index.mjs:617:11)",
        "    at createRuntime (file:///var/runtime/index.mjs:1222:5)",
        "    at async ignition (file:///var/runtime/index.mjs:1637:21)"
    ]
}

I've tried both the currently latest versions:
@vendia/serverless-express 4.12.6
AND
@codegenie/serverless-express 4.17.0

This is my code:

import serverlessExpress from '@vendia/serverless-express'
import app from './express.js'

export default serverlessExpress({
  app,
  binarySettings: {
    isBinary: () => true,
    contentEncodings: [],
  },
  resolutionMode: 'PROMISE',
})

A basic promise handler like this one did work so it seems not to be a generic problem with the new Lambda node 24:

export default async function handler(event, context) {
  return {
    statusCode: 200,
    headers: {
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      healthy: true,
      status: 200,
    }),
  }
}

Did anyone ever managed to use @vendia/serverless-express with lambda runtime node 24?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions