getsentry / self-hosted

Sentry, feature-complete and packaged up for low-volume deployments and proofs-of-concept
https://develop.sentry.dev/self-hosted/
Other
7.75k stars 1.75k forks source link

Alert emails are not sent to some users #1791

Open afaianswq opened 1 year ago

afaianswq commented 1 year ago

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

hubertdeng123 commented 1 year ago

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?

afaianswq commented 1 year ago

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.

hubertdeng123 commented 1 year ago

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.

afaianswq commented 1 year ago

Yes, I did. And it worked. My email is similar to other users emails: firstname.lastname@company.tld, nothing special with it.

afaianswq commented 1 year ago

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.

hubertdeng123 commented 1 year ago

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 😕

afaianswq commented 1 year ago

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.

github-actions[bot] commented 1 year ago

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 🥀

afaianswq commented 1 year ago

No way.

afaianswq commented 1 year ago

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

ethanhs commented 1 year ago

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.

afaianswq commented 1 year ago

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.

github-actions[bot] commented 1 year ago

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 🥀