richpeck / exception_handler

Ruby on Rails Custom Error Pages
509 stars 70 forks source link

Unable to send email notifications for dev env #111

Open dimalsv opened 3 months ago

dimalsv commented 3 months ago

I put the following configs to application.rb and development.rb

  config.exception_handlder = {
    dev: true,
    email: 'junglebrandlviv@gmail.com',

    exceptions: {
      500 => { notification: true }
    }
  }

also I switched config.consider_all_requests_local to false for dev env.

I run project from docker and I have the following configs for emails

  config.action_mailer.perform_deliveries = true
  if ENV.fetch('IN_DOCKER', 'false') === 'true'
    # Use mailcatcher if app is running without docker
    config.action_mailer.delivery_method = :smtp
    config.action_mailer.smtp_settings = { address: 'mailcatcher', port: 1025 }
  else
    # Use letter_opener if app is running without docker
    config.action_mailer.delivery_method = :letter_opener
    config.action_mailer.perform_caching = false
  end

and it works perfectly for any other notification. Also I was setting up exception_notification gem and it also was working well. But I guess exception_handlder is a better choice for me.

When I trigger 500 exception I don't see anything in logs as well, only 500 error and it does not trigger exception_handlder mail notification.