Skip to content

fix(parser): identitySource can be null in APIGatewayRequestAuthorizerEventV2Schema #3485

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/parser/src/schemas/apigwv2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ const APIGatewayRequestAuthorizerEventV2Schema = z.object({
version: z.literal('2.0'),
type: z.literal('REQUEST'),
routeArn: z.string(),
identitySource: APIGatewayStringArray,
identitySource: APIGatewayStringArray.nullish(),
routeKey: z.string(),
rawPath: z.string(),
rawQueryString: z.string(),
Expand Down
15 changes: 15 additions & 0 deletions packages/parser/tests/unit/schema/apigwv2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,21 @@ describe('API Gateway HTTP (v2) Schemas', () => {
// Assess
expect(parsedEvent).toEqual(event);
});

it('should parse the authorizer event with null identitySource', () => {
// Prepare
const event = getTestEvent({
eventsPath,
filename: 'authorizer-request',
});
event.identitySource = null;

// Act
const parsedEvent = APIGatewayRequestAuthorizerEventV2Schema.parse(event);

// Assess
expect(parsedEvent).toEqual(event);
});
});

describe('APIGatewayRequestContextV2Schema', () => {
Expand Down
Loading