New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix cookie extraction during OAuth for REST based AWS API GW + Lambda app #451
Conversation
Codecov Report
@@ Coverage Diff @@
## main #451 +/- ##
=======================================
Coverage 91.34% 91.34%
=======================================
Files 167 167
Lines 5499 5501 +2
=======================================
+ Hits 5023 5025 +2
Misses 476 476
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
@@ -75,20 +75,17 @@ def handle(self, event, context): | |||
|
|||
|
|||
def to_bolt_request(event) -> BoltRequest: | |||
"""Note that this handler supports only the payload format 2.0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch 👍
cookies = multiValueHeaders.get("Cookie", []) | ||
cookies = multiValueHeaders.get("cookie", []) | ||
if len(cookies) == 0: | ||
# Try using uppercase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Summary:
This pull request is related to #379.
I too deployed a Bolt-python app to AWS Lambda, integrated with REST (format v1.0) based API GW. In the process of the verification of oauth redirect, the app could not be installed properly. Taking a look at the CloudWatch logs I could see the multivalueheader in the request had the key "cookie" instead of "Cookie" as is expected by "to_bolt_request".
After modifying the following line to account for lower case "cookie", everything worked fine:
I think the comment about
to_bolt_request
not supporting REST API can now be removed because I tried and it worksCategory (place an
x
in each of the[ ]
)slack_bolt.App
and/or its core componentsslack_bolt.async_app.AsyncApp
and/or its core componentsslack_bolt.adapter
/docs
Requirements (place an
x
in each[ ]
)Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.
./scripts/install_all_and_run_tests.sh
after making the changes.