Skip to content

Improve request parser for better compatibility with Socket Mode - #169

Merged
seratch merged 1 commit into
slackapi:mainfrom
seratch:safer-extraction
Dec 3, 2020
Merged

seratch merged 1 commit into
slackapi:mainfrom
seratch:safer-extraction

Conversation

@seratch

@seratch seratch commented Dec 3, 2020 •

Copy link
Copy Markdown
Contributor

This pull request improves the internals to be �compatible with Socket Mode payloads.

Category (place an x in each of the [ ])

  • slack_bolt.App and/or its core components
  • slack_bolt.async_app.AsyncApp and/or its core components
  • Adapters in slack_bolt.adapter
  • Document pages under /docs
  • Others

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.

  • I've read and understood the Contributing Guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've run ./scripts/install_all_and_run_tests.sh after making the changes.

@seratch
seratch merged commit e1942cd into slackapi:main Dec 3, 2020
@seratch
seratch deleted the safer-extraction branch December 3, 2020 10:26
@bharat-rangan

Copy link
Copy Markdown

@seratch - Hi. I am using the slack_bolt package and started getting a new error. Looking at the logs, I traced back to this PR on the same part of the code. I am getting this when I am trying to send a message-shortcut. (I can't pinpoint why the change you made would cause the issue but the timing is curious. Can you please help?

Let me know how I can get more logs to help.

Here is the error.

Exception happened during processing of request from ('127.0.0.1', 44298)
Traceback (most recent call last):
  File "/usr/lib/python3.7/socketserver.py", line 316, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python3.7/socketserver.py", line 347, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python3.7/socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.7/http/server.py", line 646, in __init__
    super().__init__(*args, **kwargs)
  File "/usr/lib/python3.7/socketserver.py", line 720, in __init__
    self.handle()
  File "/usr/lib/python3.7/http/server.py", line 426, in handle
    self.handle_one_request()
  File "/usr/lib/python3.7/http/server.py", line 414, in handle_one_request
    method()
  File "/app/.local/lib/python3.7/site-packages/slack_bolt/app/app.py", line 881, in do_POST
    body=request_body, query=query, headers=self.headers
  File "/app/.local/lib/python3.7/site-packages/slack_bolt/request/request.py", line 43, in __init__
    self.context = build_context(BoltContext(context if context else {}), self.body)
  File "/app/.local/lib/python3.7/site-packages/slack_bolt/request/internals.py", line 114, in build_context
    enterprise_id = extract_enterprise_id(payload)
  File "/app/.local/lib/python3.7/site-packages/slack_bolt/request/internals.py", line 54, in extract_enterprise_id
    elif "id" in org:
TypeError: argument of type 'NoneType' is not iterable

@seratch

seratch commented Dec 7, 2020

Copy link
Copy Markdown
Contributor Author

@bharat-rangan Can you upgrade to v1.1.1? The fix by this PR is included in the version.

@bharat-rangan

Copy link
Copy Markdown

hmm.... I did a force pip-installed and it worked. Sorry if this was a distraction

@bharat-rangan

Copy link
Copy Markdown

aha. Just saw your message. Thanks for contributing to this package :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants