Closed mokolabs closed 6 years ago
@mokolabs can you please show your full initializers/email.rb
?
@nashby It is identical to the code block I pasted above (which was copied from the README).
I just placed that same code in my email.rb initializer file. Is there a different syntax I should be using?
@mokolabs it's just strange that stacktrace says about line 14 in email.rb but if it's identical to README there shouldn't be line 14.
@nashby Sorry for the confusion. Good catch.
My email.rb
initializer did have this block for configuring production STMP settings:
# Send emails
if Rails.env.production? or ENV['SEND_EMAIL_VIA_SMTP'] == 'true'
ActionMailer::Base.smtp_settings = {
:user_name => ENV['SENDGRID_USERNAME'],
:password => ENV['SENDGRID_PASSWORD'],
:domain => 'heroku.com',
:address => 'smtp.sendgrid.net',
:port => 587,
:authentication => :plain,
:enable_starttls_auto => true
}
end
But that code was completely unrelated to the Letter Opener error. Temporarily, I removed the SMTP code above so that my email.rb
initializer now contains only configuration code for Letter Opener.
LetterOpener.configure do |config|
# To overrider the location for message storage.
# Default value is <tt>tmp/letter_opener</tt>
config.location = Rails.root.join('tmp', 'my_mails')
# To render only the message body, without any metadata or extra containers or styling.
# Default value is <tt>:default</tt> that renders styled message with showing useful metadata.
config.message_template = :light
end
I still get the same error. Here's the stack trace:
09:34:36 web.1 | => Booting Thin
09:34:36 web.1 | => Rails 5.2.0.beta2 application starting in development on http://localhost:3000
09:34:36 web.1 | => Run `rails server -h` for more startup options
09:34:38 web.1 | /Users/patrick/Sites/ziegfeld/config/initializers/email.rb:1:in `<main>': undefined method `configure' for LetterOpener:Module (NoMethodError)
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bootsnap-1.1.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `load'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bootsnap-1.1.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `load'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0.beta2/lib/active_support/dependencies.rb:277:in `block in load'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0.beta2/lib/active_support/dependencies.rb:249:in `load_dependency'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0.beta2/lib/active_support/dependencies.rb:277:in `load'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/engine.rb:657:in `block in load_config_initializer'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0.beta2/lib/active_support/notifications.rb:170:in `instrument'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/engine.rb:656:in `load_config_initializer'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/engine.rb:614:in `block (2 levels) in <class:Engine>'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/engine.rb:613:in `each'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/engine.rb:613:in `block in <class:Engine>'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/initializable.rb:32:in `instance_exec'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/initializable.rb:32:in `run'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/initializable.rb:61:in `block in run_initializers'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:228:in `block in tsort_each'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:431:in `each_strongly_connected_component_from'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/initializable.rb:50:in `each'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/initializable.rb:50:in `tsort_each_child'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:415:in `call'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:415:in `each_strongly_connected_component_from'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:349:in `block in each_strongly_connected_component'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:347:in `each'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:347:in `call'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:347:in `each_strongly_connected_component'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:226:in `tsort_each'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:205:in `tsort_each'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/initializable.rb:60:in `run_initializers'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/application.rb:360:in `initialize!'
09:34:38 web.1 | from /Users/patrick/Sites/ziegfeld/config/environment.rb:5:in `<main>'
09:34:38 web.1 | from config.ru:3:in `require_relative'
09:34:38 web.1 | from config.ru:3:in `block in <main>'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:55:in `instance_eval'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:55:in `initialize'
09:34:38 web.1 | from config.ru:in `new'
09:34:38 web.1 | from config.ru:in `<main>'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:49:in `eval'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:49:in `new_from_string'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:40:in `parse_file'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/server.rb:319:in `build_app_and_options_from_config'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/server.rb:219:in `app'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/commands/server/server_command.rb:27:in `app'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/server.rb:354:in `wrapped_app'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/commands/server/server_command.rb:89:in `log_to_stdout'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/commands/server/server_command.rb:51:in `start'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/commands/server/server_command.rb:147:in `block in perform'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/commands/server/server_command.rb:142:in `tap'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/commands/server/server_command.rb:142:in `perform'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/command/base.rb:65:in `perform'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/command.rb:46:in `invoke'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/commands.rb:18:in `<main>'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bootsnap-1.1.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bootsnap-1.1.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0.beta2/lib/active_support/dependencies.rb:283:in `block in require'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0.beta2/lib/active_support/dependencies.rb:249:in `load_dependency'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0.beta2/lib/active_support/dependencies.rb:283:in `require'
09:34:38 web.1 | from /Users/patrick/Sites/ziegfeld/bin/rails:9:in `<top (required)>'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
09:34:38 web.1 | from /Users/patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
09:34:38 web.1 | from /Users/patrick/Sites/ziegfeld/bin/spring:15:in `require'
09:34:38 web.1 | from /Users/patrick/Sites/ziegfeld/bin/spring:15:in `<top (required)>'
09:34:38 web.1 | from bin/rails:3:in `load'
09:34:38 web.1 | from bin/rails:3:in `<main>'
09:34:38 web.1 | Exiting
09:34:38 web.1 | exited with code 1
09:34:38 system | sending SIGTERM to all processes
09:34:38 log.1 | terminated by SIGTERM
09:34:38 worker.1 | terminated by SIGTERM
Hope that makes more sense now!
Exact same problem here with config.
@DaveTorbeck @mokolabs sorry guys, I forgot that configuration feature is not released yet. Could you please try master and see if that works? If it's ok I'll make a new release. Thanks!
Right, I tested it myself and released version 1.5.0. Thank you for letting me know about this issue!
Sweet. Thanks!
I'm trying to use this code from the README in an initializer:
But I'm getting this error:
Is this just an issue with 5.2? Or am I doing something wrong?