Some AWS lambdas are invoked via custom authorizers and they have the type APIGatewayProxyWithLambdaAuthorizerEvent<TAuthorizerContext>. With the current 'aws:apiGateway' eventType, setting up something like this:
const event = createEvent('aws:apiGateway', {
body: JSON.stringify({ message: 'this is a message' }),
requestContext: {
authorizer: {
user: JSON.stringify({ id: 12345, name: 'Satoshi Nakamoto', roleId: 1 }),
},
},
});
... results in this TypeScript error:
Type '{ authorizer: { user: string; }; }' is missing the following properties from type 'APIGatewayEventRequestContextWithAuthorizer<APIGatewayEventDefaultAuthorizerContext>': accountId, apiId, protocol, httpMethod, and 7 more.
I wonder if it would make sense to either
- Apply a
DeepPartial on body to allow for nested requestContext.
- Create a new eventType called
'aws:apiGatewayWithCustomAuthorizer'.
I like Option 2 better because of it being hyper clear about what it is doing.
Some AWS lambdas are invoked via custom authorizers and they have the type
APIGatewayProxyWithLambdaAuthorizerEvent<TAuthorizerContext>. With the current'aws:apiGateway'eventType, setting up something like this:... results in this
TypeScripterror:I wonder if it would make sense to either
DeepPartialonbodyto allow for nestedrequestContext.'aws:apiGatewayWithCustomAuthorizer'.I like
Option 2better because of it being hyper clear about what it is doing.