ravsamhq / notify-slack-action

🔔 Send a Slack Notification from Github Actions regarding failure, warnings, or even success.
https://ravsam.in/blog/send-slack-notification-when-github-actions-fails/
MIT License
173 stars 57 forks source link

Error: No SLACK_WEBHOOK_URL provided after upgrading to v2? #62

Closed spokenbird closed 2 years ago

spokenbird commented 2 years ago

Hello,

I just upgraded to ravsamhq/notify-slack-action@v2 and am now seeing failures in the announce to slack action with the error thrown reading: Error: No SLACK_WEBHOOK_URL

We are however providing a SLACK_WEBHOOK_URL as seen in our config below:

- name: Announce on Slack
        if: always()
        uses: ravsamhq/notify-slack-action@v2
        with:
          status: ${{ job.status }}
        env:
          SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

Might you be able to provide any insights? Screen Shot 2022-09-09 at 4 05 33 PM

ravsam-bot[bot] commented 2 years ago

Hello and welcome to RavSam :purple_heart:. Thanks for opening your first issue. I will assign one of our team members to take a look at the problem you have raised. Make sure to include as much information as possible to help our team diagnose the issue and solve it quickly.

If the problem is related to a security concern, then please delete this issue and send us an email at info@ravsam.in.

ravgeetdhillon commented 2 years ago

@spokenbird It is working well on my end. Are you sure you have added the SLACK_WEBHOOK_URL in the secrets?

Screenshot 2022-09-10 at 1 43 27 PM

Screenshot 2022-09-10 at 1 43 36 PM

spokenbird commented 2 years ago

I just replaced it to be absolutely sure and yes it's definitely there though even after replacing it the run still breaks on the announce to Slack step. Same error.

I also tried reverting back to v1 and get a different error this time it says:

Traceback (most recent call last):
  File "/app/main.py", line 202, in <module>
    main()
  File "/app/main.py", line 197, in main
    notify_slack(payload)
  File "/app/main.py", line 171, in notify_slack
    requests.post(url, data=payload, headers=headers)
  File "/app/requests/api.py", line 117, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/app/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/app/requests/sessions.py", line 515, in request
    prep = self.prepare_request(req)
  File "/app/requests/sessions.py", line 453, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File "/app/requests/models.py", line 3[18](https://github.com/codeforamerica/form-flow-starter/actions/runs/3035978176/jobs/4894211855#step:9:19), in prepare
    self.prepare_url(url, params)
  File "/app/requests/models.py", line 392, in prepare_url
    raise MissingSchema(error)
requests.exceptions.MissingSchema: Invalid URL '': No scheme supplied. Perhaps you meant http://?

I notice it mentions http:// on the last line but our slack webhook URL uses https, would that matter?

bshibilov-sh commented 1 year ago

Is there any update on this issue? We are also experiencing the same problem with no SLACK_WEBHOOK_URL provided.