Repository navigation
fix(parser): keep Lambda authorizer context in APIGatewayProxyEventModel - #8813
Merged
leandrodamascena merged 1 commit intoNov 15, 2026
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #8813 +/- ##
========================================
Coverage 97.17% 97.17%
========================================
Files 323 323
Lines 16606 16609 +3
Branches 1504 1504
========================================
+ Hits 16137 16140 +3
Misses 328 328
Partials 141 141 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
leandrodamascena
approved these changes
Nov 15, 2026
leandrodamascena
left a comment
Contributor
There was a problem hiding this comment.
Thanks @Manishram-ai! Small and right: extra="allow" is exactly what this model needed, since the authorizer's context keys are the user's own. The data class had been exposing them for a while, good to have the model catch up. Goes out in 3.41.0, no need to rebase, you'll be in the release notes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Issue number:
closes #8801
Summary
Changes
APIGatewayEventAuthorizernow declaresprincipalIdandintegrationLatencyand allows extra keys, so the custom keys a Lambda authorizer returns in itscontextmap are kept. They can be read as attributes or frommodel_extra.tests/events/apiGatewayProxyEventPrincipalId.json.The
APIGatewayProxyEventdata class already exposes these throughprincipal_id,integration_latencyandget_context(), and the TypeScript schema keeps them since aws-powertools/powertools-lambda-typescript#5749.User experience
Today,
requestContext.authorizeron a REST API event behind a Lambda authorizer parses toclaims=None scopes=None, and the principal ID and context are lost. With this change the snippet in the issue printsprincipalId='user-123' integrationLatency=42 tenantId='t-9'. Events from Cognito authorizers parse the same as before, since this only adds fields.Since the model allows extra keys now,
model_dump()on the event also includes the authorizer's context keys.Verification
develop('APIGatewayEventAuthorizer' object has no attribute 'principalId') and passes with this change.tests/unit/parser,tests/functional/parserandtests/functional/event_handler: 1531 passed, 1 skipped (Python 3.12).ruff check,ruff format --checkandmypyare clean.claimsandscopes, like a Cognito one, still parses with no extra keys.apiGatewayProxyEventPrincipalId.jsonevent.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.