You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: AppSync identity from a Lambda authorizer (AWS_LAMBDA) is wrapped in AppSyncIdentityIAM #8718
With AppSync AWS_LAMBDA authorization, the resolver event identity is what the authorizer returned in resolverContext, for example {"resolverContext": {"userId": "u-1", "tier": "gold"}}. AppSyncResolverEvent.identity should return a dedicated class exposing resolver_context, so the only field that exists in this mode is reachable through a typed property.
Current Behaviour
get_identity_object in aws_lambda_powertools/utilities/data_classes/appsync_resolver_event.py has two outcomes: an identity with sub becomes AppSyncIdentityCognito, anything else becomes AppSyncIdentityIAM. A Lambda-authorizer identity has neither sub nor IAM fields, so it lands on AppSyncIdentityIAM and every property on it (account_id, user_arn, source_ip, cognito_identity_*) raises KeyError. resolverContext is only reachable as a raw dict.
Add AppSyncIdentityLambda(DictWrapper) with a resolver_context property returning the dict the authorizer produced (see the AppSync docs on Lambda authorization: the identity object carries resolverContext).
Add a fixture with a Lambda-authorizer identity under tests/events/, tests through AppSyncResolverEvent(event).identity, and a line in docs/utilities/data_classes.md.
Keep the existing dispatch for sub (Cognito and OIDC) and the IAM fallback unchanged.
This is a good first issue. Everything needed is in the file above plus the tests next to it; no AWS resources are required to reproduce.
For those interested in contributing, please leave a comment below so that we can assign the issue to you and make sure we don't duplicate efforts. If you have any further questions, please don't hesitate to ask below or on our Discord server.
I'd like to work on this one. Plan is the dispatch + AppSyncIdentityLambda class as described (class with resolver_context, resolverContext dispatch before the IAM fallback, unit test with a Lambda-authorizer fixture, and the docs line). I'll open a PR against develop shortly; happy to adjust the shape if you prefer something different.
Activity
powertools-for-aws-oss-automation commentedon Oct 31, 2026
Note
For those interested in contributing, please leave a comment below so that we can assign the issue to you and make sure we don't duplicate efforts. If you have any further questions, please don't hesitate to ask below or on our Discord server.
Goldloli commentedon Oct 31, 2026
I'd like to work on this one. Plan is the dispatch +
AppSyncIdentityLambdaclass as described (class withresolver_context,resolverContextdispatch before the IAM fallback, unit test with a Lambda-authorizer fixture, and the docs line). I'll open a PR againstdevelopshortly; happy to adjust the shape if you prefer something different.leandrodamascena commentedon Oct 31, 2026
@Goldloli it's yours, I'll review #8720. Note that #8705 touches the same docstring and will land first, so expect a small rebase after it merges.