Skip to content

Handle Slack errors #196

@scriptin

Description

@scriptin

Hello,

One of our jobs has this as the last step:

    - uses: act10ns/slack@v1
      with:
        status: ${{ job.status }}
        channel: '#build-notifications'
      if: always()

In one build, this step failed with a following error:

Error: A request error occurred: read ECONNRESET
Error: Error: A request error occurred: read ECONNRESET
    at Object.requestErrorWithOriginal (/home/runner/work/_actions/act10ns/slack/v1/dist/index.js:2694:33)
    at IncomingWebhook.send (/home/runner/work/_actions/act10ns/slack/v1/dist/index.js:2584:32)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

As a result:

  • Our deployment has actually finished okay
  • This job failed
  • We haven't received a notification about either of those

I do understand that this particular error is caused by the Slack API, but the outcome is so confusing that I decided to create this issue anyway. Looking at your code, there is no error handling around IncomingWebhook.send call. I don't know if that would help, but maybe you know a way to prevent this from happening.

The best thing which comes to my mind is some basic retry strategy, which is only triggered whenever network errors like this one occur (ignoring the normal Slack errors). Something like promise-retry may be helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions