self-hosted icon indicating copy to clipboard operation
self-hosted copied to clipboard

Alert emails are not sent to some users

Open afaianswq opened this issue 3 years ago • 13 comments

Self-Hosted Version

22.9.0

CPU Architecture

x86_64

Docker Version

20.10.21

Docker Compose Version

2.12.2

Steps to Reproduce

  1. Create alert rule to fire on every new event
  2. Set action to "Send notification to Member" and chose specific member
  3. Trigger alert by sending a dummy event (i.e. division by zero via example python script)

Expected Result

Alert is triggered and email is sent to chosen member

Actual Result

Alert is triggered but email is never sent, according to mail server logs. Here's what I see in docker compose logs:

sentry-self-hosted-worker-1                                    | 08:16:36 [INFO] sentry.mail.adapter: mail.adapter.notification.dispatched (event_id='908d0e6e0d1b4eb0b91348e872152933' group_id=1053720 is_from_mail_action_adapter=True target_type='Member' target_identifier=2 rule_id=53 project_id=1 digest_key='mail:p:1:Member:2')

So the email was dispatched but never reached SMTP server.

I tried to send notification to a Team with problematic user among others. Emails were sent to all users excepting the problematic one. No errors in logs. Email just not being sent.

In this particular case the problematic user is myself. I can send a testing mail to myself via https://my-sentry-host.tld/manage/status/mail/ and it works, only the alert emails are not being sent, and only to me. server.

I tried to send notification to a Team with problematic user among others. Emails were sent to

Event ID

No response

afaianswq avatar Nov 01 '22 08:11 afaianswq

So just to confirm, you're able to send a test email to yourself (problematic user) and it works, but it's not sending an email on alerts. If you try "Send notification to Member" for a non-problematic user, does that work?

hubertdeng123 avatar Nov 01 '22 12:11 hubertdeng123

So just to confirm, you're able to send a test email to yourself (problematic user) and it works, but it's not sending an email on alerts. If you try "Send notification to Member" for a non-problematic user, does that work?

Yes, exactly.

afaianswq avatar Nov 01 '22 12:11 afaianswq

Have you tried to "Send notification to member" and select a non problematic member, does that work? I'm wondering if there's something different about your email versus other emails in the team.

hubertdeng123 avatar Nov 01 '22 13:11 hubertdeng123

Yes, I did. And it worked. My email is similar to other users emails: [email protected], nothing special with it.

afaianswq avatar Nov 01 '22 13:11 afaianswq

I created a new Sentry instance from scratch (using the same configuration files) and it doesn't have an issue with sending email alerts to me. So only the production instance fails for some reason. Unfortunately, I cannot reset the production instance, so any suggestions on how to fix it are welcome.

afaianswq avatar Nov 01 '22 13:11 afaianswq

Ah, that does sound weird...I'm not able to reproduce this on my own so I'm afraid I can't assist more until there's more information 😕

hubertdeng123 avatar Nov 02 '22 15:11 hubertdeng123

I can provide any information, but I can't imagine what exactly will be helpful here. If there is a way to increase mail queue processing log level, that would be helpful. It could reveal what went wrong inside sentry.mail.adapter and why it didn't send email after logging "mail.adapter.notification.dispatched" event.

afaianswq avatar Nov 02 '22 16:11 afaianswq

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

github-actions[bot] avatar Nov 24 '22 00:11 github-actions[bot]

No way.

afaianswq avatar Nov 24 '22 03:11 afaianswq

Can someone please change status so the bot leaves this ticket alone? The issue didn't magically disappear, unfortunately.

afaianswq avatar Nov 24 '22 03:11 afaianswq

So the email was dispatched but never reached SMTP server.

It could be that the destination email server just dropped the email. If you don't have SPF/DMARC/etc setup then some mail servers will not accept your emails. For our own self-hosted Sentry dogfood instance we ended up using sendgrid because we wanted to make sure our emails would not get blocked by an aggressive filter.

emmatyping avatar Nov 28 '22 19:11 emmatyping

It could be that the destination email server just dropped the email.

No it couldn't because I used locally installed postfix to monitor what's going on, and Sentry didn't even try to connect to it. At the same time it successfully connected and sent mails to other users.

afaianswq avatar Nov 29 '22 03:11 afaianswq

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

github-actions[bot] avatar Dec 21 '22 00:12 github-actions[bot]