thoughtbot / griddler

Simplify receiving email in Rails (deprecated)
http://griddler.io/
MIT License
1.38k stars 199 forks source link

NoMethodError (undefined method `normalize_params' for nil:NilClass) #197

Closed anka closed 9 years ago

anka commented 9 years ago

I am using

rails (4.2.0)
griddler (1.1.0)
griddler-mandrill (1.0.2)

and I am hosting it on heroku. When sending a test mail from mandrill I get the following error message:

2015-02-06T16:57:24.729489+00:00 app[web.1]: NoMethodError (undefined method `normalize_params' for nil:NilClass):
2015-02-06T16:57:24.729491+00:00 app[web.1]:   vendor/bundle/ruby/2.2.0/gems/griddler-1.1.0/app/controllers/griddler/emails_controller.rb:15:in `normalized_params'
2015-02-06T16:57:24.729493+00:00 app[web.1]:   vendor/bundle/ruby/2.2.0/gems/griddler-1.1.0/app/controllers/griddler/emails_controller.rb:3:in `create'
2015-02-06T16:57:24.729496+00:00 app[web.1]:   vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
2015-02-06T16:57:24.729497+00:00 app[web.1]:   vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/abstract_controller/base.rb:198:in `process_action'
2015-02-06T16:57:24.729499+00:00 app[web.1]:   vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_controller/metal/rendering.rb:10:in `process_action'
2015-02-06T16:57:24.729501+00:00 app[web.1]:   vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
2015-02-06T16:57:24.729502+00:00 app[web.1]:   vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:117:in `call'
2015-02-06T16:57:24.729504+00:00 app[web.1]:   vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:117:in `call'
gabebw commented 9 years ago

It looks like Griddler.configuration.email_service isn't set. Can you run this in the rails console:

Griddler.configuration.email_service

and paste the result?

gabebw commented 9 years ago

If you didn't explicitly set email_service, that needs to be set, as detailed here.

anka commented 9 years ago

Thanks, you are totally right. It was my fault, I thought the config would be defaulted to the example. I added the initializer and now I have set Mandrill as the adapter but now I get

2015-02-06T20:38:31.214727+00:00 app[web.1]: ArgumentError (wrong number of arguments (1 for 0)):
2015-02-06T20:38:31.214731+00:00 app[web.1]:   vendor/bundle/ruby/2.2.0/gems/griddler-1.1.0/app/controllers/griddler/emails_controller.rb:19:in `initialize'
2015-02-06T20:38:31.214733+00:00 app[web.1]:   vendor/bundle/ruby/2.2.0/gems/griddler-1.1.0/app/controllers/griddler/emails_controller.rb:19:in `new'
2015-02-06T20:38:31.214735+00:00 app[web.1]:   vendor/bundle/ruby/2.2.0/gems/griddler-1.1.0/app/controllers/griddler/emails_controller.rb:19:in `process_email'
2015-02-06T20:38:31.214737+00:00 app[web.1]:   vendor/bundle/ruby/2.2.0/gems/griddler-1.1.0/app/controllers/griddler/emails_controller.rb:4:in `block in create'
2015-02-06T20:38:31.214739+00:00 app[web.1]:   vendor/bundle/ruby/2.2.0/gems/griddler-1.1.0/app/controllers/griddler/emails_controller.rb:3:in `each'
2015-02-06T20:38:31.214741+00:00 app[web.1]:   vendor/bundle/ruby/2.2.0/gems/griddler-1.1.0/app/controllers/griddler/emails_controller.rb:3:in `create'
2015-02-06T20:38:31.214743+00:00 app[web.1]:   vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
2015-02-06T20:38:31.214745+00:00 app[web.1]:   vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/abstract_controller/base.rb:198:in `process_action'

I am hosting this on heroku. Any thoughts on this one?

gabebw commented 9 years ago

It looks like your processor class takes zero arguments to its initialize method, but it should take one (the email). We have an example EmailProcessor - what does your EmailProcessor class look like?

anka commented 9 years ago

Ok I am so sorry for bothering you with my mistakes. I think I copied some older version of the example email processor. Now everything is working well.

gabebw commented 9 years ago

Great! Happy to help.