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: UnauthorizedException raises TypeError when using documented keyword arguments #7693
The public docs for AppSync exceptions state that UnauthorizedException accepts optional keyword arguments.
Current Behaviour
The implementation forwards those kwargs directly to Exception.__init__, which doesn’t accept keyword arguments, so any caller passing a documented kwarg receives TypeError.
Traceback (most recent call last):
File "/data/src/test.py", line 4, in <module>
UnauthorizedException("Access denied", trace_id="abc123")
File "/home/hdd/miniconda3/envs/py312/lib/python3.12/site-packages/aws_lambda_powertools/event_handler/events_appsync/exceptions.py", line 24, in __init__
super().__init__(message, *args, **kwargs)
TypeError: UnauthorizedException() takes no keyword arguments
Possible Solution
Fix could be either consume/record kwargs inside UnauthorizedException before calling super().__init__, or remove **kwargs from the signature/docs to reflect the real capability.
Steps to Reproduce
Run the repro script.
Powertools for AWS Lambda (Python) version
latest
AWS Lambda function runtime
3.12
Packaging format used
PyPi
Debugging logs
Note: This issue was identified by an automated testing tool for academic research and manually verified. If you have any concerns about this type of reporting, please let me know, and I will adjust my workflow accordingly.
Hi! Yes, I think we need to remove **kwargs from the signature to avoid confusing customers, as we don't accept it. Also, the UnauthorizedException exception is only used to return messages to AppSync, not additional arguments.
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 reopen the issue, or open a new issue referencing this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
Activity
leandrodamascena commentedon Nov 15, 2025
Hi! Yes, I think we need to remove
**kwargsfrom the signature to avoid confusing customers, as we don't accept it. Also, theUnauthorizedExceptionexception is only used to return messages to AppSync, not additional arguments.Could you submit a PR to fix this?
T90REAL commentedon Nov 17, 2025
Sure. I will submit a PR for this.
powertools-for-aws-oss-automation commentedon Nov 17, 2025
Warning
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 reopen the issue, or open a new issue referencing this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
github-actions commentedon Jan 5, 2026
This is now released under 3.24.0 version!