Skip to content
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

Action does not error when message could not be sent #9

Closed
4 of 10 tasks
gr2m opened this issue Aug 21, 2021 · 2 comments · Fixed by #333
Closed
4 of 10 tasks

Action does not error when message could not be sent #9

gr2m opened this issue Aug 21, 2021 · 2 comments · Fixed by #333
Labels
enhancement New feature or request
Milestone

Comments

@gr2m
Copy link

gr2m commented Aug 21, 2021

Description

I'm new to Slack's APIs, and I only installed the action. I missed to install the new app to the channel I want it to send a message to, the PR at #5 would have saved me some time ;)

I wanted to let you know that although the error is logged to the output, the action still exists as if sending the message succeeded.

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

Filling out the following details about bugs will help us solve your issue sooner.

Reproducible in:

package version: latest

node version: any

OS version(s): any

Steps to reproduce:

  1. Create new slack app
  2. Install on workspace
  3. Without adding the app to a channel, try to send a message to it

Expected result:

Action should fail with helpful instructions

Actual result:

Error is logged, but exist status is still 0

Attachments:

Sorry I've re-ran the action and have no longer access to the run that failed

@seratch
Copy link
Member

seratch commented Nov 7, 2021

Thanks for the great input. Displaying actionable error messages would be more helpful to developers.

@seratch seratch added the enhancement New feature or request label Nov 7, 2021
@seratch seratch added this to the 1.x milestone Nov 24, 2021
@zimeg zimeg linked a pull request Nov 15, 2024 that will close this issue
8 tasks
@zimeg zimeg modified the milestones: 1.x, 2.0 Nov 15, 2024
@zimeg
Copy link
Member

zimeg commented Nov 15, 2024

👋 With the @2.0.0 release we now have the errors input option that can be set to true to cause the step to fail if the request fails and the message can't be sent for some reason:

- name: Send a message to nowhere
  uses: slackapi/slack-github-action@v2.0.0
  with:
    errors: true
    method: chat.postMessage
    token: ${{ secrets.SLACK_BOT_TOKEN }}
    payload: |
      channel: ""
      text: "Greetings!"

This setup will cause the step to fail with the following error:

SlackError: An API error occurred: channel_not_found

Thanks again for this suggestion too! I'll close this issue, but with excitement to be catching errors a few steps earlier now 🙏 ✨

@zimeg zimeg closed this as completed Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants