Rails 7 API only exception not working
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
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?
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.
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.