-
Notifications
You must be signed in to change notification settings - Fork 161
Closed
Closed
Copy link
Labels
loggerThis item relates to the Logger UtilityThis item relates to the Logger Utilitynot-a-bugNew and existing bug reports incorrectly submitted as bugNew and existing bug reports incorrectly submitted as bugrejectedThis is something we will not be working on. At least, not in the measurable futureThis is something we will not be working on. At least, not in the measurable future
Description
Expected Behaviour
The project would compile successfully
Current Behaviour
Using @middy/core v1.5.1 & just updated @aws-lambda-powertools/logger to v1.5.1 and I believe that adding the middy interface #1225 is causing a TS compilation error in my project. I was able to get rid of it by downgrading to v1.5.0.
The following compilation error I am presented with is
Argument of type 'MiddlewareLikeObj<unknown, unknown, Error, Context>' is not assignable to parameter of type 'MiddlewareObject<APIGatewayProxyEvent, { statusCode: number; body: string; }, Context> | MiddlewareObject<APIGatewayProxyEvent, { ...; }, Context>[]'.
Type 'MiddlewareLikeObj<unknown, unknown, Error, Context>' is not assignable to type 'MiddlewareObject<APIGatewayProxyEvent, { statusCode: number; body: string; }, Context>'.
Types of property 'before' are incompatible.
Type 'MiddlewareFn<unknown, unknown, Error, Context>' is not assignable to type 'MiddlewareFunction<APIGatewayProxyEvent, { statusCode: number; body: string; }, Context>'.
Types of parameters 'request' and 'handler' are incompatible.
Property 'internal' is missing in type 'HandlerLambda<APIGatewayProxyEvent, { statusCode: number; body: string; }, Context>' but required in type 'Request<unknown, unknown, Error, Context>'.ts(2345)
middy.d.ts(14, 5): 'internal' is declared here.
I came to this conclusion by looking at the last line middy.d.ts(14, 5): 'internal' is declared here.
which was introduced in this PR introduced #1225.
Code snippet
import { APIGatewayEvent } from 'aws-lambda';
import { Logger, injectLambdaContext } from '@aws-lambda-powertools/logger';
import middy from '@middy/core'
const lambdaHandler = async (event: APIGatewayEvent) => {
const { sub: userId } = event.requestContext.authorizer!.claims;
}
export const handler = middy(lambdaHandler)
.use(injectLambdaContext(logger, { logEvent: true }));
Possible Solution
No response
Steps to Reproduce
Install @middy/core v1.5.1 & and set @aws-lambda-powertools/logger to v1.5.1
AWS Lambda Powertools for TypeScript version
1.51
AWS Lambda function runtime
14.x
Packaging format used
Npm
Execution logs
No response
Metadata
Metadata
Assignees
Labels
loggerThis item relates to the Logger UtilityThis item relates to the Logger Utilitynot-a-bugNew and existing bug reports incorrectly submitted as bugNew and existing bug reports incorrectly submitted as bugrejectedThis is something we will not be working on. At least, not in the measurable futureThis is something we will not be working on. At least, not in the measurable future
Type
Projects
Status
Closed