Action fails silently when the API call fails
Description
There may have been a network issue which causes an API call to fail. However, the workflow did not fail. The workflow was using Slack Bot Token and a Channel ID while posting a payload.
What type of issue is this? (place an x in one of the [ ])
- [x] bug
- [ ] enhancement (feature request)
- [ ] question
- [ ] documentation related
- [ ] example code 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
Reproducible in:
package version: 1.16.0
node version:
OS version(s): Ubuntu 20
Steps to reproduce:
- With a step looking like this
users: slackapi/[email protected]
with:
channel-id: XXXXX
payload: {
"text": "Some text",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Some text*"
}
}
]
}
env:
SLACK_BOT_TOKEN: ***
- Not sure how you could simulate Slack API going down... I am guessing you want this line to raise an exception: https://github.com/slackapi/slack-github-action/blob/3658c412d46a3dc37a1ec651891c1e64f2981ec8/src/slack-send.js#L66
It is worth noting that the said step runs fine many times, so I am pretty sure that the payload and parameters are set correctly.
Expected result:
The step causes the workflow to error
Actual result:
The workflow passes.
Attachments:
Error logged:
(node:2465) UnhandledPromiseRejectionWarning: Error: An API error occurred: fatal_error
at Object.platformErrorFromResult (/home/runner/work/_actions/slackapi/slack-github-action/v1.16.0/dist/index.js:5082:33)
at WebClient.apiCall (/home/runner/work/_actions/slackapi/slack-github-action/v1.16.0/dist/index.js:4685:28)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:2465) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:2465) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Hi @kitchoi, thanks for taking the time to report this issue. At that timing, the Slack server-side had an incident: https://status.slack.com/2022-02-22 If this GitHub action does not result in failure in the scenario, the error handling should be improved in future versions.
Thank you @seratch for your prompt response.
In case this helps, I was able to reproduce a similar silent failure by deliberately supplying a channel ID that does not exist:
(node:1680) UnhandledPromiseRejectionWarning: Error: An API error occurred: channel_not_found
at Object.platformErrorFromResult (/home/runner/work/_actions/slackapi/slack-github-action/v1.16.0/dist/index.js:5082:[33](https://github.com/organization/repo/runs/5295133106?check_suite_focus=true#step:7:33))
at WebClient.apiCall (/home/runner/work/_actions/slackapi/slack-github-action/v1.16.0/dist/index.js:4685:28)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:1680) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1680) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Thanks. Yes, I managed to reproduce the issue on my end.