-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Metronome-Industries/node-mock-aws-events
#5Description
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
onbody
to allow for nestedrequestContext
. - Create a new eventType called
'aws:apiGatewayWithCustomAuthorizer'
.
I like Option 2
better because of it being hyper clear about what it is doing.
Metadata
Metadata
Assignees
Labels
No labels