Bug: AppSync identity from a Lambda authorizer (AWS_LAMBDA) is wrapped in AppSyncIdentityIAM
I maintainer di solito rispondono entro 2 giorni
@Goldloli ci sta già lavorando.
Dal 31/10/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Expected Behaviour
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.
Code snippet
from aws_lambda_powertools.utilities.data_classes.appsync_resolver_event import get_identity_object
identity = get_identity_object({"resolverContext": {"userId": "u-1", "tier": "gold"}})
print(type(identity).__name__) # AppSyncIdentityIAM
identity.account_id # KeyError: 'accountId'
Possible Solution
- Add
AppSyncIdentityLambda(DictWrapper)with aresolver_contextproperty returning the dict the authorizer produced (see the AppSync docs on Lambda authorization: theidentityobject carriesresolverContext). - In
get_identity_object, dispatch on"resolverContext" in identitybefore the IAM fallback, and update the return type ofidentityand the docstring line that #8705 left marked as unverified. - Add a fixture with a Lambda-authorizer identity under
tests/events/, tests throughAppSyncResolverEvent(event).identity, and a line indocs/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.
Powertools for AWS Lambda (Python) version
latest
AWS Lambda function runtime
3.13
Packaging format used
PyPi
Debugging logs
No response
- Lingua principale
- Python
- Stelle
- 3.3k
- Fork
- 511
- Merge medio
- 3g 12h
- PR unite (30g)
- 93
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di aws-powertools/powertools-lambda-python
-
Bug: POWERTOOLS_IDEMPOTENCY_DISABLED set to an empty or non-boolean value crashes every invocationForse già presa @lechakrawarthy l’ha presa oggi. Apertabug good first issue help wanted idempotency
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
aws-powertools/powertools-lambda-python#8728 · 2 commenti ·
I maintainer di solito rispondono entro 2 giorni
-
bug good first issue help wanted idempotency
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
aws-powertools/powertools-lambda-python#8727 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
bug good first issue help wanted idempotency
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
aws-powertools/powertools-lambda-python#8726 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
bug good first issue help wanted idempotency
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
aws-powertools/powertools-lambda-python#8725 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
Bug: with a DynamoDB composite key, DataRecord.idempotency_key is the static partition key valueForse già presa @sumedh-aerram l’ha presa oggi. Apertabug good first issue help wanted idempotency
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
aws-powertools/powertools-lambda-python#8724 · 2 commenti ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di aws-powertools/powertools-lambda-python
Issue simili
-
PluginProvider.storeInstance races and clobbers the dedup cache for concurrent loadsForse già presa @Wilson0511 l’ha presa oggi. Apertaneeds-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 2 giorni
-
community documentation good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
kagent-dev/kagent#3462 ·
I maintainer di solito rispondono entro 1 giorno