Skip to content

Action fails silently when the API call fails #63

@kitchoi

Description

@kitchoi

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 [ ])

  • bug
  • enhancement (feature request)
  • question
  • documentation related
  • example code 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

Reproducible in:

package version: 1.16.0

node version:

OS version(s): Ubuntu 20

Steps to reproduce:

  1. With a step looking like this
  users: slackapi/slack-github-action@v1.16.0
  with:
    channel-id: XXXXX
    payload: {
    "text": "Some text",
    "blocks": [
      {
        "type": "section",
        "text": {
          "type": "mrkdwn",
          "text": "*Some text*"
        }
      }
    ]
  }
  env:
    SLACK_BOT_TOKEN: ***
  1. Not sure how you could simulate Slack API going down... I am guessing you want this line to raise an exception:
    await web.chat.postMessage({ channel: channelId, text: message, ...(payload || {}) });

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions