Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails 7 Cancel My Account #5478

Closed
erdemtopal opened this issue Mar 12, 2022 · 7 comments · Fixed by #5548
Closed

Rails 7 Cancel My Account #5478

erdemtopal opened this issue Mar 12, 2022 · 7 comments · Fixed by #5548

Comments

@erdemtopal
Copy link

Devise "Cancel my account" is not responsing. turbo_devise_gem else / redirect gives error.

  • Ruby 3.0.1
  • Rails 7.0.2.3
  • Latest Devise

I hope devise gem is going to suitable for rails 7 soon

@jasonfb
Copy link

jasonfb commented Mar 22, 2022

on 7.0.2.3 I'm seeing the error again of basically no Devise pages responding as expected.

the Rails-side does this for me when I log in:

16:26:26 web.1  | Started POST "/users/sign_in" for 127.0.0.1 at 2022-03-22 16:26:26 -0400
16:26:26 web.1  | Processing by Devise::SessionsController#create as TURBO_STREAM
16:26:26 web.1  |   Parameters: {"authenticity_token"=>"[FILTERED]", "user"=>{"email"=>"noone@nowhere.com", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Log in"}
16:26:26 web.1  |   User Load (1.4ms)  SELECT "users".* FROM "users" WHERE "users"."email" = $1 ORDER BY "users"."id" ASC LIMIT $2  [["email", "noone@nowhere.com"], ["LIMIT", 1]]
16:26:26 web.1  | Redirected to http://127.0.0.1:3000/
16:26:26 web.1  | Completed 302 Found in 290ms (ActiveRecord: 1.4ms | Allocations: 2333)
16:26:26 web.1  | 
16:26:26 web.1  | 
16:26:26 web.1  | Started GET "/" for 127.0.0.1 at 2022-03-22 16:26:26 -0400
16:26:26 web.1  | Processing by HomeController#index as TURBO_STREAM
16:26:26 web.1  |   Rendering home/index.erb
16:26:26 web.1  |   Rendered home/index.erb (Duration: 0.0ms | Allocations: 15)
16:26:26 web.1  | Completed 200 OK in 0ms (Views: 0.2ms | ActiveRecord: 0.0ms | Allocations: 339)
16:26:26 web.1  | 
16:26:26 web.1  | 

the browser side does this:
Screen Shot 2022-03-22 at 4 29 47 PM

this appears with the main branch of devise as of today, 2022-03-22, against tubro-rails 1.0.1 and an app I made last week rails 7.0.2.2

gem 'devise', git: 'https://github.com/heartcombo/devise.git'

I will try to create a reproduction app again. I fear there may be some blame game going on here between Rails + Devise maintainers here because this has been going for quite a while. I think what happens here will significantly affect the future of the ecosystem and whether or not people actually come back to Rails at all.

I too would like to get to the bottom of this because it has gone on for months and months now and these error messages are extremely disappearing and confusing to work with.

@jasonfb
Copy link

jasonfb commented Mar 22, 2022

I should mention these are brand new esbuild apps running with ./bin/dev and jsbundling. what I'm seeing is that the front end just doesn't change after a form submission but the Rails-side mysteriously processes both the session, the redirect, and the GET to the home controller itself.

also I have this in my HomeController:

class HomeController < ApplicationController
  def index
    respond_to do |format|
      format.html
      format.turbo_stream
    end

  end
end

and a corresponding files at home/index.erb and home/index.turbo_stream.erb but still the symptom persists.

@carlosantoniodasilva
Copy link
Member

I fear there may be some blame game going on here between Rails + Devise maintainers here because this has been going for quite a while.

I don't understand what you mean here. I am a Devise & Rails core maintainer.


It's been stated a few times that Devise does not work with Turbo yet, but it does work with Rails 7 as long as turbo features are disabled on Devise related forms/links. If you need/want to use Turbo, there are a couple of PRs that might be of help, just search around.

It will be eventually fixed and there will be a new Devise version that is fully compatible, we are just not there yet.

@jasonfb
Copy link

jasonfb commented Mar 22, 2022

@erdemtopal -- I think the answer is here #5340

@jasonfb
Copy link

jasonfb commented Mar 22, 2022

@carlosantoniodasilva -- I meant no offense personally. I think lots and lots of people are going down this rabbit hole from what I can tell which seems like an opportunity for better documentation at the very least. Notwithstanding, your request for patience from the community is highly reasonable.

@mices
Copy link

mices commented Aug 6, 2022

Is there a rails 7 integration guide because I'm having problems also

carlosantoniodasilva added a commit that referenced this issue Jan 31, 2023
Treat `:turbo_stream` request format as a navigational format, much like
HTML, so Devise/responders can work properly.

Allow configuring the `error_status` and `redirect_status` using the
latest responders features, via a new custom Devise responder, so we can
customize the both responses to match Hotwire/Turbo behavior, for
example with `422 Unprocessable Entity` and `303 See Other`,
respectively. The defaults aren't changing in Devise itself (yet), so it
still responds on errors cases with `200 OK`, and redirects on non-GET
requests with `302 Found`, but new apps are generated with the new
statuses and existing apps can opt-in. Please note that these defaults
might change in a future release of Devise.

PRs/Issues references:

#5545
#5529
#5516
#5499
#5487
#5467
#5440
#5410
#5340

#5542
#5530
#5519
#5513
#5478
#5468
#5463
#5458
#5448
#5446
#5439
carlosantoniodasilva added a commit that referenced this issue Jan 31, 2023
Treat `:turbo_stream` request format as a navigational format, much like
HTML, so Devise/responders can work properly.

Allow configuring the `error_status` and `redirect_status` using the
latest responders features, via a new custom Devise responder, so we can
customize the both responses to match Hotwire/Turbo behavior, for
example with `422 Unprocessable Entity` and `303 See Other`,
respectively. The defaults aren't changing in Devise itself (yet), so it
still responds on errors cases with `200 OK`, and redirects on non-GET
requests with `302 Found`, but new apps are generated with the new
statuses and existing apps can opt-in. Please note that these defaults
might change in a future release of Devise.

PRs/Issues references:

#5545
#5529
#5516
#5499
#5487
#5467
#5440
#5410
#5340

#5542
#5530
#5519
#5513
#5478
#5468
#5463
#5458
#5448
#5446
#5439
carlosantoniodasilva added a commit that referenced this issue Jan 31, 2023
Treat `:turbo_stream` request format as a navigational format, much like
HTML, so Devise/responders can work properly.

Allow configuring the `error_status` and `redirect_status` using the
latest responders features, via a new custom Devise responder, so we can
customize the both responses to match Hotwire/Turbo behavior, for
example with `422 Unprocessable Entity` and `303 See Other`,
respectively. The defaults aren't changing in Devise itself (yet), so it
still responds on errors cases with `200 OK`, and redirects on non-GET
requests with `302 Found`, but new apps are generated with the new
statuses and existing apps can opt-in. Please note that these defaults
might change in a future release of Devise.

PRs/Issues references:

#5545
#5529
#5516
#5499
#5487
#5467
#5440
#5410
#5340

#5542
#5530
#5519
#5513
#5478
#5468
#5463
#5458
#5448
#5446
#5439
carlosantoniodasilva added a commit that referenced this issue Jan 31, 2023
Treat `:turbo_stream` request format as a navigational format, much like
HTML, so Devise/responders can work properly.

Allow configuring the `error_status` and `redirect_status` using the
latest responders features, via a new custom Devise responder, so we can
customize the both responses to match Hotwire/Turbo behavior, for
example with `422 Unprocessable Entity` and `303 See Other`,
respectively. The defaults aren't changing in Devise itself (yet), so it
still responds on errors cases with `200 OK`, and redirects on non-GET
requests with `302 Found`, but new apps are generated with the new
statuses and existing apps can opt-in. Please note that these defaults
might change in a future release of Devise.

PRs/Issues references:

#5545
#5529
#5516
#5499
#5487
#5467
#5440
#5410
#5340

#5542
#5530
#5519
#5513
#5478
#5468
#5463
#5458
#5448
#5446
#5439
@carlosantoniodasilva
Copy link
Member

The main branch should contain all that's necessary for fully working with Turbo now, which should fix this. A new version will be released soon, but feel free to test it out from the main branch in the meantime, and report back on any issues. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

4 participants