node-slack-sdk: Attempting to use the SDK when Slack is down will crash the Node process
Description
Perhaps I’m just missing the proper way to handle these errors, but as far as I can tell if Slack is offline or unreachable in various ways (as it was this morning), the Slack SDK will terminate the Node process on use and you cannot catch the errors.
This looks to be due to the use of a setInterval
within the got
dependency.
TypeError: "string" must be a string, Buffer, or ArrayBuffer
at Function.byteLength (buffer.js:441:11)
at Timeout.setInterval [as _onTimeout] (/code/node_modules/got/index.js:207:35)
at ontimeout (timers.js:488:11)
at tryOnTimeout (timers.js:323:5)
at Timer.listOnTimeout (timers.js:283:5)
Also, simply disabling the internet connection causes this crash:
Error: getaddrinfo ENOTFOUND slack.com slack.com:443
at errnoException (dns.js:50:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:91:26)
What type of issue is this? (place an x
in one of the [ ]
)
- bug
- enhancement (feature request)
- question
- documentation 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.
Bug Report
Filling out the following details about bugs will help us solve your issue sooner.
Reproducible in:
@slack/client
version: 4.2.2
node version: v8.1.4
OS version(s): macOS 10.13.3 and linux
Steps to reproduce:
- Turn off your internet connection
- Wrap the Slack SDK calls in
try
/catch
and handle promise rejections. - Attempt to run the code.
Expected result:
A catchable error would be thrown or a callback would fail.
Actual result:
Process crashes.
Attachments:
none
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 21 (11 by maintainers)
No errors found during test on a RocketChat 0.67.0.