aws / aws/chalice

Default value for current_request attribute is missed

Open
#1,987 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
11.1k
Forks
1k
Avg merge
1d 22h
Merged PRs (30d)
2

Description

Hey everyone!

I believe that while the team worked on adding type definitions in `app.py` file they missed default value for `current_request` attribute in `Chalice` class. You can find this change [here](https://github.com/aws/chalice/commit/afd23d7d729f8383033fe3851bc1de5effd1f22f#diff-272b6876974adbd1241c810bc0a9ba848ac4927dc5422f1a6c89ee0662c7f406R1245).
By default this value was `None`. And after this change different issues are faced, e.g. in our case these were issues with authorizers for endpoints - endpoint started return 500 errors instead of 403.

Setting default parameter as `None` will fix the issues related to this attribute:
```
current_request: Optional[Request] = None
```
Could somebody from the team to take a look at this?

Regards,
Anastasiia

Contributor guide

Open the contributing guide

Research direction

Start in app.py at the Chalice.current_request type definition and compare it with the referenced earlier change. Confirm that the attribute retains its default behavior for authorizer endpoint handling; done means the missing default is restored and the reported 403-versus-500 behavior is addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, authorization, backend
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.