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

Redirect loop during checkout (checkout -> registration -> address -> registration) #151

Closed
ahx opened this issue Jan 3, 2014 · 4 comments

Comments

@ahx
Copy link

ahx commented Jan 3, 2014

I have a problem getting the master versions of spree and spree_auth_devise to work together. When being redirected to the registration page, i get stuck in a redirect loop.
I could not reproduce the issue when running the checkout feature spec, which run fine, but when running the app in development.
Here's a plain simple example app (running Rails 4.0.2) to reproduce the error: https://github.com/ahx/spree_auth_devise_redirect_issue
You can find more details about all gem versions there.

I am seeing this error in Firefox 26 and Chrome 31.

Here are some parts of the log that illustrate the issue:

Redirected to http://localhost:3000/checkout/registration
Filter chain halted as :check_registration rendered or redirected
Completed 302 Found in 23ms (ActiveRecord: 1.7ms)
[…]
Started GET "/checkout/registration" for 127.0.0.1 at 2014-01-03 22:25:06 +0100
Processing by Spree::CheckoutController#edit as HTML
[…]
Redirected to http://localhost:3000/checkout/address
Filter chain halted as :ensure_valid_state rendered or redirected
Completed 302 Found in 14ms (ActiveRecord: 1.2ms)
[…]
Started GET "/checkout/address" for 127.0.0.1 at 2014-01-03 22:25:06 +0100
Processing by Spree::CheckoutController#edit as HTML
Parameters: {"state"=>"address"}
[…]
Spree::TokenizedPermission Load (0.2ms)  SELECT "spree_tokenized_permissions".* FROM "spree_tokenized_permissions" WHERE "spree_tokenized_permissions"."permissable_id" = ? AND "spree_tokenized_permissions"."permissable_type" = ? ORDER BY "spree_tokenized_permissions"."id" ASC LIMIT 1  [["permissable_id", 6], ["permissable_type", "Spree::Order"]]
Redirected to http://localhost:3000/checkout/registration
Filter chain halted as :check_registration rendered or redirected
Completed 302 Found in 106ms (ActiveRecord: 2.2ms)

Started GET "/checkout/registration" for 127.0.0.1 at 2014-01-03 22:25:06 +0100
Processing by Spree::CheckoutController#edit as HTML

Parameters: {"state"=>"registration"}
@ahx
Copy link
Author

ahx commented Jan 5, 2014

Ok, this seems to be caused by some loading issues.
I fixed this by moving spree_auth_devise beneath spree in the Gemfile. 🍻

@radar
Copy link
Contributor

radar commented Jan 5, 2014

Yes, this is important because Spree needs to be required (by Bundler) before any of its extensions.

@radar radar closed this as completed Jan 5, 2014
@saschagehlich
Copy link

saschagehlich commented Jan 5, 2020

I'm seeing this issue with spree 4.0.1 and spree_auth_devise 4.0.0, even though spree_auth_devise is beneath spree in Gemfile. Any hints?

Edit: The problem seems to be that, after redirecting to the address step, spree checks if address is a valid step for the order. But since order's checkout_steps method returns an array that does NOT include registration, it fails and redirects back to checkout, which redirects to registration (due to the check_registration before_action)...

@saschagehlich
Copy link

Just noticed that this was my fault, I'm overriding all of spree's routes and forgot to include the routes that spree_auth_devise is creating. Sorry!

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

No branches or pull requests

3 participants