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

Long comments trigger Slack error #4374

Closed
rmens opened this issue Oct 16, 2023 · 3 comments
Closed

Long comments trigger Slack error #4374

rmens opened this issue Oct 16, 2023 · 3 comments
Labels

Comments

@rmens
Copy link
Contributor

rmens commented Oct 16, 2023

We had a comment containing 1201 words (6130 characters) that wasn't posted to Slack to be moderated. The length seems to trigger an error:

{
  "name":"coral",
  "hostname":"xxxx",
  "pid":1,
  "level":50,
  "err":{
    "message":"slack returned non-200 status code: 400",
    "name":"Error",
    "stack":"SlackCoralEventListener.postMessage (src/core/server/events/listeners/slack/slack.ts:56:13)\nrunMicrotasks (<anonymous>)\nsrc/core/server/events/listeners/slack/slack.ts:136:13\nasync Promise.all (index 0)\nasync Promise.all (index 0)\nObject.publish (src/core/server/events/event.ts:61:7)\nObject.publishCommentCreated (src/core/server/services/events/comments.ts:71:5)\nasync Promise.all (index 1)\nObject.publishChanges (src/core/server/stacks/helpers/publishChanges.ts:76:3)\nObject.create (src/core/server/stacks/createComment.ts:469:3)\nObject.mapFieldsetToErrorCodes (src/core/server/graph/errors.ts:17:12)\ncreateComment (src/core/server/graph/resolvers/Mutation.ts:13:13)\n"
  },
  "tenantID":"xxxx",
  "payload":{
    "id":"xxxx",
    "createdAt":"2023-10-16T07:10:10.019Z",
    "data":{
      "commentID":"xxxx",
      "storyID":"xxxx",
      "siteID":"xxxxx"
    },
    "type":"COMMENT_CREATED"
  },
  "channel":{
    "enabled":true,
    "name":"Metro #coral",
    "hookURL":"https://hooks.slack.com/services/xxxx/xxxx/xxxx",
    "triggers":{
      "reportedComments":false,
      "pendingComments":false,
      "featuredComments":false,
      "allComments":true,
      "staffComments":false
    }
  },
  "msg":"could not post the comment to slack",
  "time":"2023-10-16T07:10:10.293Z",
  "src":{
    "file":"/usr/src/app/src/core/server/events/listeners/slack/slack.ts",
    "line":141
  },
  "v":0
}

Slack trace

SlackCoralEventListener.postMessage (src/core/server/events/listeners/slack/slack.ts:56:13)
runMicrotasks (<anonymous>)
src/core/server/events/listeners/slack/slack.ts:136:13
async Promise.all (index 0)
async Promise.all (index 0)
Object.publish (src/core/server/events/event.ts:61:7)
Object.publishCommentCreated (src/core/server/services/events/comments.ts:71:5)
async Promise.all (index 1)
Object.publishChanges (src/core/server/stacks/helpers/publishChanges.ts:76:3)
Object.create (src/core/server/stacks/createComment.ts:469:3)
Object.mapFieldsetToErrorCodes (src/core/server/graph/errors.ts:17:12)
createComment (src/core/server/graph/resolvers/Mutation.ts:13:13)

Expected behavior:
All comments to be posted to Slack.

Actual behavior:
Long comment not posted.

Version:
Coral 8.5.0.

@rmens rmens added the bug label Oct 16, 2023
@losowsky
Copy link
Member

Thanks for reporting - sounds like it's hitting a Slack limit. We'll add a ticket to our backlog to confirm

@kabeaty
Copy link
Contributor

kabeaty commented Nov 10, 2023

Hello, I looked into this and tested out posting a long comment to Slack from Coral. I was able to successfully send a comment with 1800 words/11000 characters to a Slack channel when using the text data variable in my workflow. Slack’s docs say that they support up to 40000 characters here (https://api.slack.com/methods/chat.postMessage#truncating).


However, for section blocks text fields, Slack says they support up to 3000 characters (https://api.slack.com/reference/block-kit/blocks#section). Perhaps this is the issue you are running into. We can update to truncate the text sent through there to less than 3000 characters so that it shouldn’t hit the limit in this case. I have opened this PR to address this: #4392

@losowsky
Copy link
Member

losowsky commented Dec 7, 2023

Fixed in the latest release: https://github.com/coralproject/talk/releases/tag/v8.6.3 Thanks for reporting!

@losowsky losowsky closed this as completed Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants