ruby on rails - devise token auth errors -


i have rails 5 app running using devise token auth, deployed on heroku.

signing in , signing works fine, however, if restart application, next sign in, gives me 500, following error.. ideas?

i have narrowed bug down, happens on heroku. when running locally in production mode fine.

vendor/bundle/ruby/2.3.0/gems/devise_token_auth-0.1.42/app/controllers/devise_token_auth/sessions_controller.rb:42:in `[]=' vendor/bundle/ruby/2.3.0/gems/devise_token_auth-0.1.42/app/controllers/devise_token_auth/sessions_controller.rb:42:in `create' 

devise initalizer:

devise.setup |config|   config.secret_key = 'xxx' 

devise token auth initalizer:

devisetokenauth.setup |config|   config.change_headers_on_each_request = false   config.token_lifespan = 1.year end 

profile.rb (model handles auth):

devise :database_authenticatable, :registerable,        :recoverable, :trackable, :validatable include devisetokenauth::concerns::user 

longer stack trace

2017-08-21t13:47:59.917645+00:00 app[web.1]: i, [2017-08-21t13:47:59.917547 #4]  info -- : [8f6962a7-f07c-4754-959c-c51dafa37d76] started post "/auth/sign_in" 82.163.112.30 @ 2017-08-21 13:47:59 +0000 2017-08-21t13:48:00.165030+00:00 app[web.1]: [8f6962a7-f07c-4754-959c-c51dafa37d76] vendor/bundle/ruby/2.3.0/gems/actionpack-5.1.3/lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action' 2017-08-21t13:48:00.165036+00:00 app[web.1]: [8f6962a7-f07c-4754-959c-c51dafa37d76] vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.3/lib/active_support/notifications.rb:166:in `instrument' 2017-08-21t13:47:59.925118+00:00 app[web.1]: i, [2017-08-21t13:47:59.925047 #4]  info -- : [8f6962a7-f07c-4754-959c-c51dafa37d76] processing devisetokenauth::sessionscontroller#create */* 2017-08-21t13:48:00.165031+00:00 app[web.1]: [8f6962a7-f07c-4754-959c-c51dafa37d76] vendor/bundle/ruby/2.3.0/gems/actionpack-5.1.3/lib/abstract_controller/base.rb:186:in `process_action' 2017-08-21t13:48:00.165036+00:00 app[web.1]: [8f6962a7-f07c-4754-959c-c51dafa37d76] vendor/bundle/ruby/2.3.0/gems/actionpack-5.1.3/lib/action_controller/metal/instrumentation.rb:30:in `process_action' 2017-08-21t13:47:59.925184+00:00 app[web.1]: i, [2017-08-21t13:47:59.925134 #4]  info -- : [8f6962a7-f07c-4754-959c-c51dafa37d76]   parameters: {"email"=>"rob@example.com", "password"=>"[filtered]", "session"=>{"email"=>"rob@example.com", "password"=>"[filtered]"}} 2017-08-21t13:48:00.165032+00:00 app[web.1]: [8f6962a7-f07c-4754-959c-c51dafa37d76] vendor/bundle/ruby/2.3.0/gems/actionpack-5.1.3/lib/action_controller/metal/rendering.rb:30:in `process_action' 2017-08-21t13:48:00.165036+00:00 app[web.1]: [8f6962a7-f07c-4754-959c-c51dafa37d76] vendor/bundle/ruby/2.3.0/gems/actionpack-5.1.3/lib/action_controller/metal/params_wrapper.rb:252:in `process_action' 2017-08-21t13:47:59.976389+00:00 app[web.1]: d, [2017-08-21t13:47:59.976252 #4] debug -- : [8f6962a7-f07c-4754-959c-c51dafa37d76]   profile load (2.1ms)  select  "profiles".* "profiles" (email = 'rob@example.com' , provider='email') order "profiles"."id" asc limit $1  [["limit", 1]] 2017-08-21t13:48:00.165032+00:00 app[web.1]: [8f6962a7-f07c-4754-959c-c51dafa37d76] vendor/bundle/ruby/2.3.0/gems/actionpack-5.1.3/lib/abstract_controller/callbacks.rb:20:in `block in process_action' 2017-08-21t13:48:00.165037+00:00 app[web.1]: [8f6962a7-f07c-4754-959c-c51dafa37d76] vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.3/lib/active_record/railties/controller_runtime.rb:22:in `process_action' 2017-08-21t13:48:00.163017+00:00 app[web.1]: i, [2017-08-21t13:48:00.162930 #4]  info -- : [8f6962a7-f07c-4754-959c-c51dafa37d76] completed 500 internal server error in 238ms (activerecord: 19.2ms) 2017-08-21t13:48:00.165033+00:00 app[web.1]: [8f6962a7-f07c-4754-959c-c51dafa37d76] vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.3/lib/active_support/callbacks.rb:131:in `run_callbacks' 2017-08-21t13:48:00.164815+00:00 app[web.1]: f, [2017-08-21t13:48:00.164748 #4] fatal -- : [8f6962a7-f07c-4754-959c-c51dafa37d76]    2017-08-21t13:48:00.165033+00:00 app[web.1]: [8f6962a7-f07c-4754-959c-c51dafa37d76] vendor/bundle/ruby/2.3.0/gems/actionpack-5.1.3/lib/abstract_controller/callbacks.rb:19:in `process_action' 2017-08-21t13:48:00.164880+00:00 app[web.1]: f, [2017-08-21t13:48:00.164820 #4] fatal -- : [8f6962a7-f07c-4754-959c-c51dafa37d76] indexerror (string not matched): 2017-08-21t13:48:00.165034+00:00 app[web.1]: [8f6962a7-f07c-4754-959c-c51dafa37d76] vendor/bundle/ruby/2.3.0/gems/actionpack-5.1.3/lib/action_controller/metal/rescue.rb:20:in `process_action' 2017-08-21t13:48:00.164933+00:00 app[web.1]: f, [2017-08-21t13:48:00.164884 #4] fatal -- : [8f6962a7-f07c-4754-959c-c51dafa37d76]    2017-08-21t13:48:00.165034+00:00 app[web.1]: [8f6962a7-f07c-4754-959c-c51dafa37d76] vendor/bundle/ruby/2.3.0/gems/actionpack-5.1.3/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action' 2017-08-21t13:48:00.165028+00:00 app[web.1]: f, [2017-08-21t13:48:00.164957 #4] fatal -- : [8f6962a7-f07c-4754-959c-c51dafa37d76] vendor/bundle/ruby/2.3.0/gems/devise_token_auth-0.1.42/app/controllers/devise_token_auth/sessions_controller.rb:42:in `[]=' 2017-08-21t13:48:00.165035+00:00 app[web.1]: [8f6962a7-f07c-4754-959c-c51dafa37d76] vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.3/lib/active_support/notifications.rb:166:in `block in instrument' 2017-08-21t13:48:00.165029+00:00 app[web.1]: [8f6962a7-f07c-4754-959c-c51dafa37d76] vendor/bundle/ruby/2.3.0/gems/devise_token_auth-0.1.42/app/controllers/devise_token_auth/sessions_controller.rb:42:in `create' 

adding migration fixed it:

reversible |direction|   direction.up     user.find_each |user|       user.tokens = nil       user.save!     end   end end 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -