diff --git a/packages/parser/src/schemas/apigwv2.ts b/packages/parser/src/schemas/apigwv2.ts index ec5cfb6156..77491d4864 100644 --- a/packages/parser/src/schemas/apigwv2.ts +++ b/packages/parser/src/schemas/apigwv2.ts @@ -13,14 +13,16 @@ const RequestContextV2Authorizer = z.object({ accessKey: z.string().optional(), accountId: z.string().optional(), callerId: z.string().optional(), - principalOrgId: z.string().optional(), + principalOrgId: z.string().nullish(), userArn: z.string().optional(), userId: z.string().optional(), - cognitoIdentity: z.object({ - amr: z.array(z.string()), - identityId: z.string(), - identityPoolId: z.string(), - }), + cognitoIdentity: z + .object({ + amr: z.array(z.string()), + identityId: z.string(), + identityPoolId: z.string(), + }) + .nullish(), }) .optional(), lambda: z.record(z.string(), z.any()).optional(), @@ -42,7 +44,7 @@ const RequestContextV2 = z.object({ .object({ clientCert: APIGatewayCert.optional(), }) - .optional(), + .nullish(), domainName: z.string(), domainPrefix: z.string(), http: RequestContextV2Http, diff --git a/packages/parser/tests/unit/schema/lambda.test.ts b/packages/parser/tests/unit/schema/lambda.test.ts index cfef867657..e9b0a3449b 100644 --- a/packages/parser/tests/unit/schema/lambda.test.ts +++ b/packages/parser/tests/unit/schema/lambda.test.ts @@ -15,4 +15,10 @@ describe('Lambda ', () => { lambdaFunctionUrlEvent ); }); + + it('should parse url IAM event', () => { + const urlIAMEvent = TestEvents.lambdaFunctionUrlIAMEvent; + + expect(LambdaFunctionUrlSchema.parse(urlIAMEvent)).toEqual(urlIAMEvent); + }); });