-
-
Notifications
You must be signed in to change notification settings - Fork 996
Description
What version of Hono are you using?
4.12.2
What runtime/platform is your app running on? (with version if possible)
AWS/CloudFront Lambda@edge Node 24
What steps can reproduce the bug?
The handle() function exported from hono/lambda-edge returns an async function with three parameters:
// node_modules/hono/dist/adapter/lambda-edge/handler.js var handle = (app) => { return async (event, context, callback) => { // ... } }
Because the returned function has .length === 3, the AWS Lambda runtime identifies it as a callback-style handler. Starting with NODEJS_24_X, AWS Lambda has deprecated callback-based handlers, producing:
This happens even though the function is async and returns a Promise — the runtime uses handler.length (i.e., the number of formal parameters) to determine the handler type, not whether it's actually async.
Reproduction:
Create a Lambda@Edge function using hono/lambda-edge
Deploy with runtime: lambda.Runtime.NODEJS_24_X
Invoke the function — it fails with Runtime.CallbackHandlerDeprecated
What is the expected behavior?
(more claude opus output...)
The handler returned by handle(app) should work on all supported Node.js Lambda runtimes (NODEJS_18_X through NODEJS_24_X) without requiring a wrapper. Since callback is already optional and the function is already async, the returned function should have .length <= 2 so the Lambda runtime correctly identifies it as an async handler. On older runtimes that still support callbacks, the behavior would be unchanged — callback can still be passed positionally and used via c.env.callback() — but it should not be a formal parameter that inflates Function.length.
What do you see instead?
No response
Additional information
No response