Have code suggestion log message for unmatched request patterns
Description
As we implemented in Python and Java, we can provide the similar guidance log messages in Bolt for JS.
$ npx node app.js
⚡️ Bolt app is running!
Unhandled request ({"event": {"type": "message"}, "type": "event_callback"})
---
[Suggestion] You can handle this type of event with the following listener function:
app.event("message", async ({ body, logger }) => {
logger.info(body);
});
- https://github.com/slackapi/bolt-python/pull/323
- https://github.com/slackapi/java-slack-sdk/pull/741
- https://github.com/slackapi/java-slack-sdk/issues/719#issuecomment-833231219
What type of issue is this? (place an x in one of the [ ])
- [ ] bug
- [x] enhancement (feature request)
- [ ] question
- [ ] documentation related
- [ ] example code related
- [ ] testing related
- [ ] discussion
Requirements (place an x in each of the [ ])
- [x] I've read and understood the Contributing guidelines and have done my best effort to follow them.
- [x] I've read and agree to the Code of Conduct.
- [x] I've searched for any related issues and avoided creating a duplicate issue.
As I was debugging my event listener in the app for quite some time and I think this functionality would have helped me a lot I would love to contribute here. However, I'm quite unsure where I need to do the required adjustments - where is this statement
Unhandled request ({"event": {"type": "message"}, "type": "event_callback"}) actually logged?
Apart from this starting point, I checked the python implementation here and would have implemented it very similar also here. Is this what was intended by you?
@TheManWhoStaresAtCode Yes, this issue is for implementing the same (or mostly the same) thing with bolt-python / bolt-java. Checking the test code may be also helpful. https://github.com/slackapi/bolt-python/blob/main/tests/slack_bolt/logger/test_unmatched_suggestions.py
Ok thanks will also check this test code. However, I still don't know where to put the respective code in the TS project. Can you point me at least to the proper file?
Although I haven't taken time to thoroughly think about the best design yet, in the case of bolt-js, the unhandled request error logging is done on the receiver side. Thus, you can place a reusable (= it does not depend on any specific modules/packages such as Node's http module interface) utility as a new file under the receivers directory and import it in each receiver.