Node-slack-sdk: rtm.sendMessage fails with error code 4 and "cannot process message"

Created on 5 Oct 2020  路  12Comments  路  Source: slackapi/node-slack-sdk

Description

Describe your issue here.

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

  • [x] bug
  • [ ] enhancement (feature request)
  • [x] question
  • [ ] documentation 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.

Bug Report

Calling the rtm.sendMessage( "test", channel ) recently started failing with the following error:

Error: An API error occurred: cannot process message
    at Object.platformErrorFromEvent (/home/tim/work/bd/techbot/node_modules/@slack/rtm-api/dist/errors.js:40:33)
    at RTMClient.eventHandler (/home/tim/work/bd/techbot/node_modules/@slack/rtm-api/dist/RTMClient.js:320:52)
    at RTMClient.emit (/home/tim/work/bd/techbot/node_modules/eventemitter3/index.js:182:35)
    at RTMClient.onWebsocketMessage (/home/tim/work/bd/techbot/node_modules/@slack/rtm-api/dist/RTMClient.js:456:14)
    at WebSocket.onMessage (/home/tim/work/bd/techbot/node_modules/ws/lib/event-target.js:120:16)
    at WebSocket.emit (events.js:315:20)
    at Receiver.receiverOnMessage (/home/tim/work/bd/techbot/node_modules/ws/lib/websocket.js:720:20)
    at Receiver.emit (events.js:315:20)
    at Receiver.dataMessage (/home/tim/work/bd/techbot/node_modules/ws/lib/receiver.js:414:14)
    at Receiver.getData (/home/tim/work/bd/techbot/node_modules/ws/lib/receiver.js:346:17) {
  code: 'slack_rtmapi_send_message_platform_error',
  data: {
    ok: false,
    reply_to: 3,
    error: { msg: 'cannot process message', code: 4, source: 'gs-pdx-6q9x' }
  }
}

It is unclear what exactly changed because the same code worked fine until a few days ago.

Packages:

Select all that apply:

  • [ ] @slack/web-api
  • [ ] @slack/events-api
  • [ ] @slack/interactive-messages
  • [x] @slack/rtm-api
  • [ ] @slack/webhooks
  • [ ] @slack/oauth
  • [ ] I don't know

Reproducible in:

package version: 5.0.5

node version: 12.18.2

OS version(s): OpenSuSE 15.2

Steps to reproduce:

Run the following test code (replace the "XXXXXX" with your Slack token):

/*jslint esversion: 6, node : true */
"use strict";

const { RTMClient } = require('@slack/rtm-api');
const rtm = new RTMClient( "XXXXXX" );


// Message event
// https://api.slack.com/events/message
rtm.on( 'message', async (event) => {

    //logger.info( "%j", event );

    // Ignore subtype messages
    if ( event.subtype !== undefined )
        return;

    try
    {
        // this doesn't work
        await rtm.sendMessage( "hello!", event.channel );
    }
    catch ( err )
    {
        console.log( err );
    }
});

async function start()
{
  // Connect to Slack
  const { self, team } = await rtm.start();
}

start();

Expected result:

The message should be sent, or an actionable error should be reported.

Actual result:

The error is generated.

question

Most helpful comment

For what it's worth; I've come across this thread whilst investigating this error when using the https://github.com/slack-go/slack library for Go, which might give further weight to the idea this is an issue on Slack's side?

All 12 comments

@gyunaev I'm sorry to hear that this has suddenly started failing for you and thanks for including a code sample to reproduce the issue!

Your issue _might_ be related to a degraded performance issue that the Slack API is experiencing right now. So I'd suggest keeping an eye on our status site and I'd appreciate an update if you find the issue resolves itself when the outage is fixed.

In the meantime, I'll try to reproduce your issue using your code sample!

@gyunaev Your sample code was great and I'm able to reproduce the same error that you're receiving. 馃憣馃徎 I've also confirmed that there are other RTM developers experiencing the same issue as you, so I don't believe it's something specific on your end. Our Slack incidents team has also confirmed that it's likely related to the current disruption.

Thank you very much for update. Would it be also possible to change the error text to something more actionable, i.e. "the message cannot be processed because of the incident investigation, please see status.slack.com" ? This would generate less bug reports and lower your support load.

Hello @mwbrooks - Although the status on the Slack Status page is giving the all clear, we are still getting this error on rtm.sendMessage. I have told my customers to watch Slack status page for resolution, but now it appears all is well at Slack but our app is broken :) Can you confirm if there may still be lingering issues here?

I can further confirm that the test sample still prints the same error.

For what it's worth; I've come across this thread whilst investigating this error when using the https://github.com/slack-go/slack library for Go, which might give further weight to the idea this is an issue on Slack's side?

Just curious if anyone has any insight or has seen an improvement? Our slack integration still appears to be down, and can't seem to find a way to get an answer from Slack folks on if it's being worked on.

The integration is down. I keep running a monitor on it, trying to send a message every 10 seconds. So far two of them went through, meaning someone is working on it, but the system is still down.

As of 18:45 Pacific time seem to be fixed.

Nope. It worked normally for a minute and then is down again.

We're sorry for the disruption. The issue should be resolved now. Please refer to https://status.slack.com/2020-10/c5a4ba206320d9a7 for details.

Indeed it worked sporadically for the last couple hours. Thank you for the confirmation!

Was this page helpful?
0 / 5 - 0 ratings