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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notifications (Slack & SMTP) aren't working #132

Closed
SelrahcD opened this issue Dec 23, 2020 · 13 comments
Closed

Notifications (Slack & SMTP) aren't working #132

SelrahcD opened this issue Dec 23, 2020 · 13 comments
Assignees
Labels
bug Something isn't working

Comments

@SelrahcD
Copy link

SelrahcD commented Dec 23, 2020

Hi 馃憢, thanks for the great project!

Describe the bug
Notifications aren't working. I've probably messed up something as I'm apparently the only one having trouble.

I've set up both Slack and SMTP via the GitHub secrets as described on the documentation. None of them are working so far.

SMTP is Gmail one, I've followed instruction from their help page.

I've tried sending me a notification using Curl for Slack and it worked.

Action logs are saying that the notification was sent

Sending notification 馃煩 Schtroumpsify (http://schtroumpsify.chorip.am/) is back up.

To Reproduce
Well, you could try to set up notifications but it might work 馃槄

Expected behavior
I should have received an email and a Slack message.

Screenshots
Capture d鈥檈虂cran 2020-12-23 a虁 18 56 00

Desktop (please complete the following information):
Not relevant

Smartphone (please complete the following information):
Not relevant

Additional context
Let me know if I can provide some more details or if it's easier for you if I split the issue in two, one for SMTP and one for Slack.
Is it possible to turn logging on?
Again, thanks for that project, it's a really clever idea to use GitHub actions for this 馃挕

@SelrahcD SelrahcD added the bug Something isn't working label Dec 23, 2020
@SelrahcD
Copy link
Author

Hi Anand,

Github marks that assigned you to the issue. Sorry for that; it's probably a misclick...

I've investigated a little the past week and wanted to share what I've seen if it can help.

I managed to display logs using the ACTIONS_STEP_DEBUG env var, setting it to true. Unfortunately, no logs are printed around the notification code.

I dug into the Uptime-monitor repo and noticed there were two notifications system, Notifications and NotifyMe.

Looking at the repo and past changes, I believe the first one is no longer in use, and NotifyMe is currently used. This is where I stopped as I didn't take the time to look at how I could provide my own version of the uptime-monitor code to add some logs. Let me know if you think giving a closer look can help.

Enjoy the holiday season.

@janik6n
Copy link

janik6n commented Jan 7, 2021

Just to add another user, I have not been able to get Slack notifications to work either. All the configuration is correct according to documentation, and the Slack webhook works when tested from elsewhere. I have not been able to find logs / mention about notifications at all from GitHub Actions logs.

@endofhome
Copy link

I don't want to hijack the thread but I am wondering if this might be an issue with notifications more generally - I haven't been able to send email notifications via Sendgrid but I can send email outside of Upptime using the same configuration.

@AnandChowdhary
Copy link
Member

I'll have a closer look this week! 馃槃

@esirK
Copy link

esirK commented Jan 13, 2021

Thanks for the good work @AnandChowdhary
Just adding that I'm also having the same issue with slack.

@pkyeck
Copy link

pkyeck commented Jan 20, 2021

Any updates on this?
I appreciate all the work you all put into this project - but notifications is one of the biggest must-haves for uptime monitoring. Fancy status-pages are nice but who is checking them every 5mins ... I want to be notified when something is wrong. So please make notifications work 鉂わ笍

@varadiz
Copy link

varadiz commented Feb 8, 2021

@AnandChowdhary
Seems like process.env is not read properly in helpers/notifme.ts.

I added this to workflows/uptime.yml as a test and got a slack notification.
NOTE: uptime.yml gets updated daily, so this is not a solution or workaround in any form.

env:
          GH_PAT: ${{ secrets.GH_PAT }}
          SECRETS_CONTEXT: ${{ toJson(secrets) }}
          NOTIFICATION_SLACK: ${{ secrets.NOTIFICATION_SLACK }} 
          NOTIFICATION_SLACK_WEBHOOK: ${{ secrets.NOTIFICATION_SLACK_WEBHOOK }} 
          NOTIFICATION_SLACK_WEBHOOK_URL: ${{ secrets.NOTIFICATION_SLACK_WEBHOOK_URL }}

I can see that workflows/uptime.yml reads all secrets and stores in an env var called SECRETS_CONTEXT.

I have tested if actions read SECRETS_CONTEXT properly, it's good.

I can also see that in the source code of upptime-monitor, it starts by getting process.env.SECRETS_CONTEXT and setting each key-value in the JSON as new process.env[key]. Here:
https://github.com/upptime/uptime-monitor/blob/bd45ff7bc3023b55708c769c4fd097fe7ffeb547/src/index.ts#L10-L14

Could you please do a console.log to check if the env vars are set properly?
Most probably the bug is somewhere here.

I can also see that helpers/environment.ts does "something" to the env variables.

UPDATE

  • I ended up deleting the update workflow
  • and I added
NOTIFICATION_SLACK: ${{ secrets.NOTIFICATION_SLACK }} 
NOTIFICATION_SLACK_WEBHOOK: ${{ secrets.NOTIFICATION_SLACK_WEBHOOK }} 
NOTIFICATION_SLACK_WEBHOOK_URL: ${{ secrets.NOTIFICATION_SLACK_WEBHOOK_URL }}

to uptime.yml

It's hacky, but it works.

@debdutdeb
Copy link

I don't want to hijack the thread but I am wondering if this might be an issue with notifications more generally - I haven't been able to send email notifications via Sendgrid but I can send email outside of Upptime using the same configuration.

Same with me. No SendGrid or SMTP.

@flaxton
Copy link

flaxton commented Mar 4, 2021

I use SendGrid on many projects/systems, but it isn't working for me on upptime.

I put the variables in both Environment (under github-pages) and Secrets, but to no avail.

@debdutdeb
Copy link

Those who want email notifications, a temporary workaround - https://github.com/debdutdeb/upptime-email-notify

This does defeat the purpose of the "no server needed" part, but for now if you can, this will help.

@AnandChowdhary
Copy link
Member

This is now (finally) fixed, thanks so much for your patience! The fix is available in upptime/uptime-monitor@v1.26.2, and the automated fix should be in your repositories within 24 hours.

You can also run Update Template CI manually to update to the latest version immediately; by default this runs once every day.

@SelrahcD
Copy link
Author

Nice, thank a lot @AnandChowdhary
Can't wait to see my website going down to see how it's going 馃檪

@aweiand
Copy link

aweiand commented Jan 10, 2022

Hi people,

It was working now? I'm have a setup with only SENDGRID and was not working... I was tested SMTP too, with gmail configuration, but seems to not working too....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants