Node-slack-sdk: 404 when attempting to use sendMessage in RTMClient

Created on 25 Mar 2020  路  17Comments  路  Source: slackapi/node-slack-sdk

Description

Issue when sending messages using the rtm.start() function. 404 being raised.

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

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

As of yesterday the rtm-client seems @slack/rtm-api seems to be returning a 404 each time it attempts to connect to slack.

const {RTMClient} = require('@slack/rtm-api');
const rtm = new RTMClient(SLACK_TOKEN);
rtm.start();

Packages:

Select all that apply:

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

Reproducible in:

package version: 5.0.3

node version: 10.15.3

OS version(s): Linux

Steps to reproduce:

Run the following code.

const {RTMClient} = require('@slack/rtm-api');
const rtm = new RTMClient(SLACK_TOKEN);
rtm.start();

Expected result:

Expect for us to be able to use the RTMClient

Actual result:

404 is raised.

[ERROR]  RTMClient:1 A websocket error occurred: Unexpected server response: 404
[ERROR]  RTMClient:1 A websocket error occurred: Unexpected server response: 404
bug rtm-api

Most helpful comment

We're sorry for the errors and thank you very much for your patience. As it seems to be all good, please allow me to close this issue.

All 17 comments

@thepont Hello, I tried to reproduce your issue but I haven't managed to see the same situation yet. Are you still facing the issue?

Hey, I am currently still seeing it, is there anyway I can assist in debugging it ?

@thepont
If you don't mind it, could you submit an inquiry to our customer support team from here? Our support agents can do a deeper and specific investigation with the information about your apps and workspaces.

My understanding so far is that your issue is not caused by this SDK, but some other factors or possibly our server-side issues. That said, if you give us some hints to simply reproduce your issue on my end, I'm happy to help you.

I am getting the same issue. Unfortunately, Slack Support team asked me to raise an issue here. 馃槥

@piyushgupta27 OK, I'm here for you to figure out what the issue is, but I haven't reproduced the 404 errors yet. There may be a specific condition causing the situation.

I don't know if this is useful, but support got me to use my token with this url https://api.slack.com/methods/rtm.connect/test and it does work although I am assuming the .start calls more then just this.

I just tested and https://api.slack.com/methods/rtm.start/test works for me too

I also just got a message from slack support attempting to handball the issue over here, I understand this is quite frustrating @seratch, being unable to replicate and the bug definitely being introduced by a change upstream.

I have done further investigation today, and can confirm that the error is occurring when he SDK attempts to establish a connection to the websocket URI that is passed back from the connect or the start methods.

While at the same time I seem to be able to establish a connection to the same URIs using the WebSocket API that is available in Chrome and Firefox, So I assume there might be some implementation differences between these and the ws package.

the ws package is attempting to do a https get to the url provided when it fails.

I hope some of this is helpful, I'm going to leave this for today and perhaps take another look tomorrow, please advise if there is anything I can check.

Adding debug logs from NodeJS SDK if this help.
slack-oncall-error-logs.txt

I don't know if this is useful, but support got me to use my token with this url https://api.slack.com/methods/rtm.connect/test and it does work although I am assuming the .start calls more then just this.

I just tested and https://api.slack.com/methods/rtm.start/test works for me too

Same for me, infact this Test tool via slack webpage gives me the same response as node SDK. As soon as the rtm.start() call is initiated, the slack websocket backend responds with "Unexpected server response: 404"
This 404 disconnects the connection and the cycle keeps on going indefinitely till the Rate Limit is hit.

[DEBUG]  RTMClient:1 transitioning to state: connecting:authenticated
Started listening to DEV_TESTING oncall bot
[ERROR]  RTMClient:1 A websocket error occurred: Unexpected server response: 404
[DEBUG]  RTMClient:1 transitioning to state: reconnecting
[DEBUG]  KeepAlive:0 stop monitoring
[DEBUG]  RTMClient:1 transitioning to state: connecting
[DEBUG]  RTMClient:1 transitioning to state: connecting:authenticating
[DEBUG]  WebClient:0 apiCall('rtm.connect') start
[DEBUG]  WebClient:0 will perform http request

I also just got a message from slack support attempting to handball the issue over here, I understand this is quite frustrating @seratch, being unable to replicate and the bug definitely being introduced by a change upstream.

I have done further investigation today, and can confirm that the error is occurring when he SDK attempts to establish a connection to the websocket URI that is passed back from the connect or the start methods.

While at the same time I seem to be able to establish a connection to the same URIs using the WebSocket API that is available in Chrome and Firefox, So I assume there might be some implementation differences between these and the ws package.

the ws package is attempting to do a https get to the url provided when it fails.

I hope some of this is helpful, I'm going to leave this for today and perhaps take another look tomorrow, please advise if there is anything I can check.

I was able to replicate the same things as shared above. Found the issue in "ws" package to be happening on the below line.

  type: 'error',
  message: 'Unexpected server response: 404',
  error: Error: Unexpected server response: 404
    at ClientRequest.req.on (/Users/piyush/Workspace/hotstar/tata-oncall-slackbot/node_modules/ws/lib/websocket.js:542:5)
    at ClientRequest.emit (events.js:182:13)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:534:21)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:109:17)
    at TLSSocket.socketOnData (_http_client.js:421:20)
    at TLSSocket.emit (events.js:182:13)
    at addChunk (_stream_readable.js:280:12)
    at readableAddChunk (_stream_readable.js:265:11)
    at TLSSocket.Readable.push (_stream_readable.js:220:10)
    at TLSWrap.onread (net.js:638:20) }

@piyushgupta27 @thepont are you guys deploying by any chance in Australia?

We are facing this same issue exclusively in AU.

Hey folks, sorry you've all been having difficulty connecting to RTM. I'm working on identifying the issue and resolving it for you.

Can you share your resolved dependency graphs with me? The easiest way to do this is to run npm ls inside your app, copy the output, and paste it in a comment here. If there's anything sensitive or private to your company in there, feel free to mask out the names of those things (replace them with xxxxxxx if you like). I'm most interested in seeing the version of dependencies of @slack/rtm-api like ws.

We believe we've identified the issue on the Slack server side. I'll update this comment when the fix is rolled out.

Update: We rolled back a change we think caused this issue. Please retry now and report back what you find so we can get some more confidence in the fix.

cc @elbuo8 @piyushgupta27 @thepont

@aoberoi working for me now, thanks for all your help

Working here too.

@aoberoi Working for me too. Appreciate the fix!

We're sorry for the errors and thank you very much for your patience. As it seems to be all good, please allow me to close this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

CoreyCole picture CoreyCole  路  12Comments

bobrik picture bobrik  路  25Comments

mmmulani picture mmmulani  路  10Comments

jayjanssen picture jayjanssen  路  13Comments

danielravina picture danielravina  路  16Comments