-
Notifications
You must be signed in to change notification settings - Fork 154
Bug: APIGatewayRequestAuthorizerEventV2Schema
has invalid definition for the identitySource
field
#3483
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
Comments
Hey @hibanka , thanks for opening the issue, this makes sense, the docs even says the identity source is optional:
Quick fix incoming... Дякую! |
This is also a bug in Powertools Python - https://github.com/aws-powertools/powertools-lambda-python/blob/develop/aws_lambda_powertools/utilities/parser/models/apigwv2.py#L75. Thanks for reporting this @hibanka. |
I just ran a quick test in the console, I can't reproduce an event with Here is an example event I have got: {
"level": "INFO",
"sampling_rate": 0,
"service": "service_undefined",
"timestamp": "2025-01-17T09:53:25.550Z",
"xray_trace_id": "1-678a2895-213d6967651dc359012d63e3",
"version": "2.0",
"type": "REQUEST",
"routeArn": "arn:aws:execute-api:eu-west-1:xxx:xxx/dev/GET/",
"routeKey": "GET /",
"rawPath": "/dev/",
"headers": {
"accept": "*/*",
"accept-encoding": "gzip, deflate",
"content-length": "0",
"host": "xxx.execute-api.eu-west-1.amazonaws.com",
"user-agent": "HTTPie/3.2.3",
"x-amzn-trace-id": "Root=1-678a2895-2366ebd0602dd62318fec21f",
"x-forwarded-for": "188.192.53.6",
"x-forwarded-port": "443",
"x-forwarded-proto": "https"
},
"requestContext": {
"accountId": "xxxx",
"apiId": "8x9ewplh90",
"domainName": "xxx.execute-api.eu-west-1.amazonaws.com",
"domainPrefix": "xxx",
"http": {
"method": "GET",
"path": "/dev/",
"protocol": "HTTP/1.1",
"sourceIp": "188.192.53.6",
"userAgent": "HTTPie/3.2.3"
},
"requestId": "EhtHagMOjoEEMLA=",
"routeKey": "GET /",
"stage": "dev",
"time": "17/Jan/2025:09:53:25 +0000",
"timeEpoch": 1737107605402
}
} I called the endpoint from my terminal via public URL. Edit: nvm, we remove null values with the logger. |
This issue is now closed. Please be mindful that future comments are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so. |
This is now released under v2.13.1 version! |
Expected Behavior
The
identitySource
field inAPIGatewayRequestAuthorizerEventV2
can be null when the Lambda authorizer is not configured with an identity source (see screenshot from the AWS Console below).Current Behavior
The current definition does not account for this scenario, leading to an error:
powertools-lambda-typescript/packages/parser/src/schemas/apigwv2.ts
Line 233 in e1bc6c5
Even the
@types/aws-lambda
package has invalid type definition:https://github.com/DefinitelyTyped/DefinitelyTyped/blob/01bf6ea3ae73629f4d488d777df91781e466ba15/types/aws-lambda/trigger/api-gateway-authorizer.d.ts#L38
Code snippet
Steps to Reproduce
When creating a Lambda authorizer, do not specify an identity source.
Possible Solution
add
.nullable()
Powertools for AWS Lambda (TypeScript) version
latest
AWS Lambda function runtime
20.x
Packaging format used
npm
Execution logs
The text was updated successfully, but these errors were encountered: