Skip to content

Have code suggestion log message for unmatched request patterns #954

Description

@seratch

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);
});

What type of issue is this? (place an x in one of the [ ])

  • bug
  • enhancement (feature request)
  • question
  • documentation related
  • example code related
  • testing related
  • discussion

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

  • 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 searched for any related issues and avoided creating a duplicate issue.

Activity

  1. added this to the 3.5.0 milestone on Jun 3, 2021
  2. self-assigned this
    on Jun 3, 2021
  3. modified the milestones: 3.5.0, 3.6.0 on Jul 14, 2021
  4. modified the milestones: 3.6.0, 3.7.0, 3.8.0 on Aug 17, 2021
  5. modified the milestones: 3.8.0, 3.9.0 on Oct 5, 2021
  6. TheManWhoStaresAtCode commented on Nov 25, 2021

    @TheManWhoStaresAtCode
    Contributor

    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?

  7. seratch commented on Nov 25, 2021

    @seratch
    ContributorAuthor

    @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

  8. TheManWhoStaresAtCode commented on Nov 25, 2021

    @TheManWhoStaresAtCode
    Contributor

    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?

  9. seratch commented on Nov 25, 2021

    @seratch
    ContributorAuthor

    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.

  10. modified the milestones: 3.9.0, on Dec 29, 2021
  11. modified the milestones: , 4.x on Sep 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions