Devise redirect to on successful login seems to get stuck on first login attempt

This sounds like an issue with your frontend (more specifically Turbolinks) rather than the backend. As your log shows, the redirect actually happens from an HTTP standpoint.

Since I haven't run into this issue myself (mainly because I haven't used Turbolinks much in more complex apps), I can only point you to a few resources that describe issues similar to yours, namely:

  • Getting turbolinks wrapper to work with Ruby on Rails Devise

I hope one of these two helps.

If not, feel free to share some frontend code – like I said, I think the issue is on the frontend, not the backend.

Try replacing your form_for with form_with in your sessions/new.html.erb. I have a similar problem (Rails 6) and it seems to be ok now.

<%= form_with(model: resource, scope: resource_name, url: session_path(resource_name)) do |f| %>

Additionally, I uncommented the Turbolinks section in config/initializers/devise.rb:

ActiveSupport.on_load(:devise_failure_app) do
  include Turbolinks::Controller