0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Lambda runtime nodejs24.x はコールバックスタイル関数をサポートしない

Last updated at Posted at 2026-01-10

ちょっとしたぼやきです。

AWS Lambda Runtime の nodejs24.x がコールバックスタイルの関数をサポートしなくなった そうですが、そういう破壊的変更をするんだったら AWS Distro for OpenTelemetry (ADOT) もきちんと nodejs24.x 対応してからにしてくださいよ…。今日時点で未対応なので、Lambda layer 組み込んだまま 24 に上げたら突然 502 Bad Gateway 返すようになって困りました。

※自分で書いた関数がコールバックスタイルの場合、デプロイして実行しようとするとこんなエラーが CloudWatch Logs に記録されます。切ない…。

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.

こんな感じで promisify するラッパー関数にくるめば回避はできますが。

function wrapCallbackFunction(fn) {
  return async (event, context) => {
    return new Promise((resolve, reject) => {
      fn(event, context, (err, result) => {
        if (err) reject(err);
        else resolve(result);
      });
    });
  };
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?