middy
middy copied to clipboard
LambdaFunctionURLHandler: Argument type error
Describe the bug A handler of type LambdaFunctionURLHandler gives an argument type error
To Reproduce
import middy from '@middy/core';
import { LambdaFunctionURLHandler } from 'aws-lambda';
const functionUrlHandler: LambdaFunctionURLHandler = async () => '';
export const handler = middy().handler(functionUrlHandler); // argument type error
See below the full error
Argument of type 'LambdaFunctionURLHandler' is not assignable to parameter of type 'MiddyInputHandler<APIGatewayProxyEventV2, any, Context>'.
Types of parameters 'callback' and 'opts' are incompatible.
Type 'MiddyHandlerObject' is not assignable to type 'Callback<LambdaFunctionURLResult<never>>'.
Type 'MiddyHandlerObject' provides no match for the signature '(error?: string | Error | null | undefined, result?: LambdaFunctionURLResult<never> | undefined): void'.ts(2345)
Expected behaviour It should compile without issues
Environment (please complete the following information):
- Node.js: [22.12.0]
- Middy: [6.1.6]
- AWS SDK [1.0.7]