Skip to content
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

Possibly missing field "user" in message_changed event #229

Closed
siketyan opened this issue Dec 14, 2023 · 2 comments · Fixed by #230
Closed

Possibly missing field "user" in message_changed event #229

siketyan opened this issue Dec 14, 2023 · 2 comments · Fixed by #230

Comments

@siketyan
Copy link
Contributor

After upgrading from 1.14.5 to 1.16.0, we are experiencing an error:

Slack listener error occurred: SlackClientProtocolError { json_error: Error("missing field `user`", line: 0, column: 0), json_body: Some(...)

It seems slack-morphism-rust expects SlackMessageEventEdited::user is not optional, but actually it is omitted when the message was edited by a bot.

Related PR: #226

This is an example of the payload which occur the error:

{
  "token": "[REDACTED]",
  "team_id": "[REDACTED]",
  "enterprise_id": "[REDACTED]",
  "context_team_id": "[REDACTED]",
  "context_enterprise_id": "[REDACTED]",
  "api_app_id": "[REDACTED]",
  "event": {
    "type": "message",
    "subtype": "message_changed",
    "message": {
      "type": "message",
      "subtype": "bot_message",
      "text": "[REDACTED]",
      "username": "[REDACTED]",
      "bot_id": "[REDACTED]",
      "app_id": "[REDACTED]",
      "blocks": [
        {
          "type": "section",
          "block_id": "FF1Ng",
          "text": {
            "type": "mrkdwn",
            "text": "[REDACTED]",
            "verbatim": false
          }
        }
      ],
      "edited": {
        "user": "[REDACTED]",
        "ts": "1702549421.000000"
      },
      "ts": "1702549413.998139",
      "source_team": "[REDACTED]",
      "user_team": "[REDACTED]"
    },
    "previous_message": {
      "type": "message",
      "subtype": "bot_message",
      "text": "[REDACTED]",
      "ts": "1702549413.998139",
      "username": "[REDACTED]",
      "bot_id": "[REDACTED]",
      "app_id": "[REDACTED]",
      "blocks": [
        {
          "type": "section",
          "block_id": "jT48G",
          "text": {
            "type": "mrkdwn",
            "text": "[REDACTED]",
            "verbatim": false
          }
        }
      ]
    },
    "channel": "[REDACTED]",
    "hidden": true,
    "ts": "1702549421.000900",
    "event_ts": "1702549421.000900",
    "channel_type": "channel"
  },
  "type": "event_callback",
  "event_id": "[REDACTED]",
  "event_time": 1702549421,
  "authorizations": [
    {
      "enterprise_id": "[REDACTED]",
      "team_id": "[REDACTED]",
      "user_id": "[REDACTED]",
      "is_bot": false,
      "is_enterprise_install": false
    }
  ],
  "is_ext_shared_channel": false,
  "event_context": "[REDACTED]"
}
@abdolence
Copy link
Owner

Hey, damn, sorry - I missed that when I reviewed the changes. Thanks for the fix!

@abdolence
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants