lorint / brick

Auto-generate models, views, controllers, and routes in a Rails app based on database structure
Other
297 stars 8 forks source link

Bug: Error with Brick + Action Mailer #22

Closed stv8 closed 1 week ago

stv8 commented 1 week ago

Hello! Hope all is well, I ran into an issue with ActionMailer+Brick while developing locally. It turns out that disabling brick caused the error to go away.

For context this was a basic email verification email being sent.

Here is the stack trace, let me know if you need any more info or context.

Stack Trace ``` 22:14:47 web.1 | [ActiveJob] Enqueued ActionMailer::MailDeliveryJob (Job ID: 820ad35d-3d2a-462c-9ea7-dac7373bb333) to Async(default) with arguments: "UserMailer", "email_verification", "deliver_now", {:params=>{:user=>#>}, :args=>[]} 22:14:47 web.1 | [ActiveJob] ↳ app/controllers/registrations_controller.rb:28:in `send_email_verification' 22:14:47 web.1 | Redirected to http://localhost:3000/ 22:14:47 web.1 | Completed 302 Found in 313ms (ActiveRecord: 13.3ms (4 queries, 0 cached) | GC: 0.0ms) 22:14:47 web.1 | 22:14:47 web.1 | 22:14:47 web.1 | Started GET "/" for 127.0.0.1 at 2024-10-21 22:14:47 -0500 22:14:47 web.1 | [ActiveJob] [ActionMailer::MailDeliveryJob] [820ad35d-3d2a-462c-9ea7-dac7373bb333] User Load (1.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = 3 LIMIT 1 /*application='SvsRails'*/ 22:14:47 web.1 | [ActiveJob] [ActionMailer::MailDeliveryJob] [820ad35d-3d2a-462c-9ea7-dac7373bb333] Performing ActionMailer::MailDeliveryJob (Job ID: 820ad35d-3d2a-462c-9ea7-dac7373bb333) from Async(default) enqueued at 2024-10-22T03:14:47.618843000Z with arguments: "UserMailer", "email_verification", "deliver_now", {:params=>{:user=>#>}, :args=>[]} 22:14:47 web.1 | [ActiveJob] [ActionMailer::MailDeliveryJob] [820ad35d-3d2a-462c-9ea7-dac7373bb333] UserMailer#email_verification: processed outbound mail in 0.1ms 22:14:47 web.1 | [ActiveJob] [ActionMailer::MailDeliveryJob] [820ad35d-3d2a-462c-9ea7-dac7373bb333] Error performing ActionMailer::MailDeliveryJob (Job ID: 820ad35d-3d2a-462c-9ea7-dac7373bb333) from Async(default) in 9.49ms: NameError (undefined local variable or method `request' for an instance of UserMailer): 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/railties-8.0.0.rc1/lib/rails/engine/lazy_route_set.rb:99:in `method_missing' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/brick-1.0.219/lib/brick/frameworks/rails/engine.rb:585:in `lookup_context' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/actionview-8.0.0.rc1/lib/action_view/rendering.rb:39:in `process' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/actionmailer-8.0.0.rc1/lib/action_mailer/base.rb:657:in `block in process' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activesupport-8.0.0.rc1/lib/active_support/notifications.rb:210:in `block in instrument' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activesupport-8.0.0.rc1/lib/active_support/notifications/instrumenter.rb:58:in `instrument' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activesupport-8.0.0.rc1/lib/active_support/notifications.rb:210:in `instrument' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/actionmailer-8.0.0.rc1/lib/action_mailer/base.rb:656:in `process' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/actionmailer-8.0.0.rc1/lib/action_mailer/parameterized.rb:140:in `block in processed_mailer' 22:14:47 web.1 | :90:in `tap' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/actionmailer-8.0.0.rc1/lib/action_mailer/parameterized.rb:138:in `processed_mailer' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/actionmailer-8.0.0.rc1/lib/action_mailer/message_delivery.rb:124:in `deliver_now' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/actionmailer-8.0.0.rc1/lib/action_mailer/mail_delivery_job.rb:28:in `perform' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activejob-8.0.0.rc1/lib/active_job/execution.rb:68:in `block in _perform_job' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activesupport-8.0.0.rc1/lib/active_support/callbacks.rb:120:in `block in run_callbacks' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/i18n-1.14.6/lib/i18n.rb:353:in `with_locale' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activejob-8.0.0.rc1/lib/active_job/translation.rb:9:in `block (2 levels) in ' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activesupport-8.0.0.rc1/lib/active_support/callbacks.rb:129:in `instance_exec' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activesupport-8.0.0.rc1/lib/active_support/callbacks.rb:129:in `block in run_callbacks' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activesupport-8.0.0.rc1/lib/active_support/core_ext/time/zones.rb:65:in `use_zone' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activejob-8.0.0.rc1/lib/active_job/timezones.rb:9:in `block (2 levels) in ' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activesupport-8.0.0.rc1/lib/active_support/callbacks.rb:129:in `instance_exec' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activesupport-8.0.0.rc1/lib/active_support/callbacks.rb:129:in `block in run_callbacks' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activesupport-8.0.0.rc1/lib/active_support/callbacks.rb:140:in `run_callbacks' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activejob-8.0.0.rc1/lib/active_job/execution.rb:67:in `_perform_job' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activejob-8.0.0.rc1/lib/active_job/instrumentation.rb:32:in `_perform_job' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activejob-8.0.0.rc1/lib/active_job/execution.rb:51:in `perform_now' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activejob-8.0.0.rc1/lib/active_job/instrumentation.rb:26:in `block in perform_now' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activerecord-8.0.0.rc1/lib/active_record/railties/job_runtime.rb:13:in `block in instrument' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activejob-8.0.0.rc1/lib/active_job/instrumentation.rb:40:in `block in instrument' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activesupport-8.0.0.rc1/lib/active_support/notifications.rb:210:in `block in instrument' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activesupport-8.0.0.rc1/lib/active_support/notifications/instrumenter.rb:58:in `instrument' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activesupport-8.0.0.rc1/lib/active_support/notifications.rb:210:in `instrument' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activejob-8.0.0.rc1/lib/active_job/instrumentation.rb:39:in `instrument' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activerecord-8.0.0.rc1/lib/active_record/railties/job_runtime.rb:11:in `instrument' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activejob-8.0.0.rc1/lib/active_job/instrumentation.rb:26:in `perform_now' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activejob-8.0.0.rc1/lib/active_job/logging.rb:32:in `block in perform_now' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activesupport-8.0.0.rc1/lib/active_support/tagged_logging.rb:143:in `block in tagged' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activesupport-8.0.0.rc1/lib/active_support/tagged_logging.rb:38:in `tagged' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activesupport-8.0.0.rc1/lib/active_support/tagged_logging.rb:143:in `tagged' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activesupport-8.0.0.rc1/lib/active_support/broadcast_logger.rb:241:in `method_missing' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activejob-8.0.0.rc1/lib/active_job/logging.rb:39:in `tag_logger' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activejob-8.0.0.rc1/lib/active_job/logging.rb:32:in `perform_now' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activejob-8.0.0.rc1/lib/active_job/execution.rb:29:in `block in execute' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activesupport-8.0.0.rc1/lib/active_support/callbacks.rb:120:in `block in run_callbacks' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activejob-8.0.0.rc1/lib/active_job/railtie.rb:95:in `block (4 levels) in ' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activesupport-8.0.0.rc1/lib/active_support/reloader.rb:77:in `block in wrap' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activesupport-8.0.0.rc1/lib/active_support/execution_wrapper.rb:91:in `wrap' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activesupport-8.0.0.rc1/lib/active_support/reloader.rb:74:in `wrap' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activejob-8.0.0.rc1/lib/active_job/railtie.rb:94:in `block (3 levels) in ' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activesupport-8.0.0.rc1/lib/active_support/callbacks.rb:129:in `instance_exec' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activesupport-8.0.0.rc1/lib/active_support/callbacks.rb:129:in `block in run_callbacks' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activesupport-8.0.0.rc1/lib/active_support/callbacks.rb:140:in `run_callbacks' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activejob-8.0.0.rc1/lib/active_job/execution.rb:27:in `execute' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/activejob-8.0.0.rc1/lib/active_job/queue_adapters/async_adapter.rb:70:in `perform' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/concurrent-ruby-1.3.4/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:359:in `run_task' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/concurrent-ruby-1.3.4/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:350:in `block (3 levels) in create_worker' 22:14:47 web.1 | :187:in `loop' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/concurrent-ruby-1.3.4/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:341:in `block (2 levels) in create_worker' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/concurrent-ruby-1.3.4/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:340:in `catch' 22:14:47 web.1 | /Users/prometheus/.gem/ruby/3.3.5/gems/concurrent-ruby-1.3.4/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:340:in `block in create_worker' ```
lorint commented 1 week ago

Heya Sean!

Thanks so much for this find -- was able to find the root cause and implement a fix that shipped in v1.0.220.

Things are pretty well over here -- had gone out to Manchester over the past few days to see some friends, and was an epic time! As well things with work are going strong. Able to have lots of fun with a few Rails projects.

All the best to you!

-Lorin

stv8 commented 1 week ago

Amazing! All good on this side of the pond too :)

Thanks for the quick response/fix, will update tonight!

Cheers