Rails routing error while using griddler gem

270 views Asked by At

I'm facing a strange issue on route added by griddler in my rails app.

routes.rb excerpt:

# mount griddler using default path: /email_processor
post '/email_processor' => 'griddler/emails#create', as: :email_processor

Rake routes

$ bundle exec rake routes RAILS_ENV=staging | grep -i 'email'
   email_processor POST     /email_processor(.:format)  griddler/emails#create

However on staging log, I'm seeing routing error.

 I, [2014-11-17T08:03:00.829592 #24344]  INFO -- : Started POST "/email_processor" for     198.37.144.147 at 2014-11-17 08:03:00 +0000
F, [2014-11-17T08:03:00.832265 #24344] FATAL -- :
ActionController::RoutingError (No route matches [POST] "/email_processor"):

When I'm trying to recognise path from rails console, I'm seeing the same error:

>  r = Rails.application.routes
 => #<ActionDispatch::Routing::RouteSet:0x0000000619f4f0>
> r.recognize_path "/email_processor"
ActionController::RoutingError: No route matches "/email_processor"

Strangely everything is working absolutely fine on my local(No routing error when I expose my local to cloud using ngrok, the post request is being processed as expected, however I still see recognise_path issue local)

Gemfile.rb

#Process incoming mail from sendgrid smtp server
gem 'griddler', "~> 1.1.0"
gem 'griddler-sendgrid', "~> 0.0.1"

Development.log excerpt:

Started POST "/email_processor" for 127.0.0.1 at 2014-11-15 14:02:22 +0530
  [1m[36mActiveRecord::SchemaMigration Load (0.9ms)[0m  [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
Processing by Griddler::EmailsController#create as HTML
..
Completed 200 OK in 63659ms (ActiveRecord: 4.0ms)

Can anybody help me understand the root cause of this issue?

Thanks

1

There are 1 answers

0
Indyarocks On

I was being dumb by assuming nginx restart happening by capistrano script(as it was not mentioned explicitly in deployment doc ). Never mind. Restarting Nginx did the job.

Thanks