exception_notification icon indicating copy to clipboard operation
exception_notification copied to clipboard

Rails 7 API only exception not working

Open nengine opened this issue 3 years ago • 3 comments

Steps to reproduce

rails g exception_notification:install --sidekiq

config/initializers/exception_notification.rb

config.add_notifier :email, { email_prefix: '[ERROR] ', sender_address: %{"Rails API Exception" [email protected]}, exception_recipients: %w{[email protected]} }

:smtp email configured and working properly with sidekiq.

Expected behavior

ActiveRecord::RecordNotFound was raised and expected to get email notification.

Actual behavior

Nothing happens. No exception email received.

System configuration

Rails version: 7.0.1 Ruby version: 3.1 Other configurations: SMTP email with sidekiq

nengine avatar Mar 09 '22 11:03 nengine

I am seeing the same issue under rails 7.0.2.2 and ruby 3.0.2. Sidekiq is able to send email but emails are not being sent via the gem. @nengine, did you figure out what was happening by chance?

backwardm avatar Jun 06 '22 19:06 backwardm

Worth mentioning that ActiveRecord::RecordNotFound is in the default list of ignored exceptions. If you want notifications of that particular exception, you'll need to redefine that list.

werebus avatar May 03 '23 20:05 werebus

I also have API only rails 6 and it does not send notification automatically but If I use ExceptionNotifier.notify_exception(e) then it works. In my case its 500 internal server error from rails app.

prsanjay avatar Jul 06 '23 12:07 prsanjay