Problems getting Sparkpost incoming email

Samuli Petrus Korhonen wrote...
When we try to get Sparkpost incoming email working we run into problem with CSRF tokens. For some reason helpy tries to verify the non-existent token (see log below) even though the request uses json. Has anyone seen this problem?

App 20069 stderr: Error during failsafe response: ActionController::InvalidAuthenticityToken
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/actionpack-4.2.10/lib/action_controller/metal/request_forgery_protection.rb:181:in `handle_unverified_request'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/actionpack-4.2.10/lib/action_controller/metal/request_forgery_protection.rb:209:in `handle_unverified_request'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/devise-3.5.6/lib/devise/controllers/helpers.rb:257:in `handle_unverified_request'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/actionpack-4.2.10/lib/action_controller/metal/request_forgery_protection.rb:204:in `verify_authenticity_token'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:432:in `block in make_lambda'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:164:in `block in halting'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:504:in `block in call'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:504:in `each'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:504:in `call'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:81:in `run_callbacks'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/actionpack-4.2.10/lib/abstract_controller/callbacks.rb:19:in `process_action'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/actionpack-4.2.10/lib/action_controller/metal/rescue.rb:29:in `process_action'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/actionpack-4.2.10/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.10/lib/active_support/notifications.rb:164:in `block in instrument'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.10/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.10/lib/active_support/notifications.rb:164:in `instrument'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/actionpack-4.2.10/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/actionpack-4.2.10/lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/activerecord-4.2.10/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/actionpack-4.2.10/lib/abstract_controller/base.rb:137:in `process'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/actionview-4.2.10/lib/action_view/rendering.rb:30:in `process'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/actionpack-4.2.10/lib/action_controller/metal.rb:196:in `dispatch'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/actionpack-4.2.10/lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/actionpack-4.2.10/lib/action_controller/metal.rb:237:in `block in action'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/actionpack-4.2.10/lib/action_dispatch/routing/route_set.rb:74:in `dispatch'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/actionpack-4.2.10/lib/action_dispatch/routing/route_set.rb:43:in `serve'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/actionpack-4.2.10/lib/action_dispatch/journey/router.rb:43:in `block in serve'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/actionpack-4.2.10/lib/action_dispatch/journey/router.rb:30:in `each'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/actionpack-4.2.10/lib/action_dispatch/journey/router.rb:30:in `serve'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/actionpack-4.2.10/lib/action_dispatch/routing/route_set.rb:817:in `call'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/actionpack-4.2.10/lib/action_dispatch/middleware/show_exceptions.rb:47:in `render_exception'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/actionpack-4.2.10/lib/action_dispatch/middleware/show_exceptions.rb:35:in `rescue in call'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/actionpack-4.2.10/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/railties-4.2.10/lib/rails/rack/logger.rb:38:in `call_app'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/railties-4.2.10/lib/rails/rack/logger.rb:20:in `block in call'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.10/lib/active_support/tagged_logging.rb:68:in `block in tagged'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.10/lib/active_support/tagged_logging.rb:26:in `tagged'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.10/lib/active_support/tagged_logging.rb:68:in `tagged'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/railties-4.2.10/lib/rails/rack/logger.rb:20:in `call'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/request_store-1.3.1/lib/request_store/middleware.rb:9:in `call'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/actionpack-4.2.10/lib/action_dispatch/middleware/request_id.rb:21:in `call'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/rack-1.6.8/lib/rack/methodoverride.rb:22:in `call'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/rack-1.6.8/lib/rack/runtime.rb:18:in `call'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/activesupport-4.2.10/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/rack-1.6.8/lib/rack/sendfile.rb:113:in `call'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/railties-4.2.10/lib/rails/engine.rb:518:in `call'
App 20069 stderr: /home/rails/.rvm/gems/ruby-2.3.3/gems/railties-4.2.10/lib/rails/application.rb:165:in `call'
App 20069 stderr: /usr/lib/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb:97:in `process_request'
App 20069 stderr: /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:160:in `accept_and_process_next_request'
App 20069 stderr: /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:113:in `main_loop'
App 20069 stderr: /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb:416:in `block (3 levels) in start_threads'
Flag for Review