-
Notifications
You must be signed in to change notification settings - Fork 663
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
Attempting to use the SDK when Slack is down will crash the Node process #586
Comments
Were you using the |
|
seems like this is the fix we'd like to see land in got: sindresorhus/got#490 |
That fix is merged into Got. Will publish a new release shortly. |
thanks so much @lukechilds! |
I don't actually have permissions to publish to npm but I've looped in the rest of the team. |
@aoberoi Done. |
@wilg i think this issue is now fixed. you should be able to get the latest updates by running |
Thanks @aoberoi! I set This is the entire stacktrace:
|
@wilg sorry for my delay in response! somehow this one got buried for me. can you do an |
This package only asks for My project (using Yarn) says:
|
@wilg we could make that change, but according to semver the caret range will match all releases less than It’s likely that you have a lock file that’s preventing your yarn from matching to the latest got release. You may need to manually run What’s confusing to me is that your shown tree doesn’t include |
Oh yeah, duh. I assumed for some reason that doing I'm not sure why it doesn't show up in
Maybe its just how I was able to properly bump the version with Making sure the version bump fixes the issue now... |
Unfortunately my app still crashes the same way with
The code that's crashing is here (calling the |
Okay, it looks like we need to reopen the investigation into this issue. Thanks for the helpful info and the link to the code where it occurs! I'm sure that will help us resolve this faster. |
No errors found during test on a RocketChat 0.67.0. |
i tried to reproduce this one again. i wasn't able to observe the error. here is what i ran: const { WebClient, retryPolicies } = require('@slack/client');
const web = new WebClient(
'xoxp-xxxxxxxxxxxxxxx',
{
logLevel: 'debug',
retryConfig: retryPolicies.fiveRetriesInFiveMinutes,
}
);
web
.channels
.list({
exclude_members: true,
exclude_archived: true,
limit: 10
})
.then(res => {
console.log('channels', res.channels);
})
.catch(error => {
console.error('Error: ', error);
}); i ran this with the network interface of my machine turned off, and got the following output.
this is exactly what i would have expected. the printing of the error is from my own catch clause, not from the process crashing. here's my dependency tree for got:
|
@wilg not that i think this is the cause of your issue, but i noticed that the following code you linked seemed like it could be cleaned up a little. here's an example: let response
const slack = this.slackClientFromRequest(request)
try {
await slack.files.upload(options) // when you don't pass a callback, this returns a Promise
} catch (e) {
response = { success: false, message: e.message }
}
return new Hub.ActionResponse(response) |
Interesting, thanks for investigating. I can't reproduce it with your script either (using the same node_modules as my main project), but I am still seeing it crash in my project. I'm trying to figure out what's different. It's definitely crashing during |
@wilg FYI, the latest versions of this package no longer use |
Going to close this issue due to inactivity. |
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 thegot
dependency.Also, simply disabling the internet connection causes this crash:
What type of issue is this? (place an
x
in one of the[ ]
)Requirements (place an
x
in each of the[ ]
)Bug Report
Filling out the following details about bugs will help us solve your issue sooner.
Reproducible in:
@slack/client
version: 4.2.2node version: v8.1.4
OS version(s): macOS 10.13.3 and linux
Steps to reproduce:
try
/catch
and handle promise rejections.Expected result:
A catchable error would be thrown or a callback would fail.
Actual result:
Process crashes.
Attachments:
none
The text was updated successfully, but these errors were encountered: