question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

/oscar/checkout/thank-you/` returns 404 when checkout_order_id not in session

See original GitHub issue

Issue Summary

Oscar 2.0 smoke tests, GET /oscar/checkout/thank-you/ returns 404.

The smoke test is obviously requesting this without going through the checkout process, so 403 could be appropriate. It is a very long stretch of the meaning of 404 to use it here - the resource was found - it was the resource is responding that it doesnt like the request context.

ThankYouView has raise http.Http404(_("No order found"))

More interesting, it only does this if a session field checkout_order_id wasnt found, which that error message does not convey accurately.

If it is about a missing field, it could be a SuspiciousOperation.

However as it is a GET, that page URL could be in a users browser history, in which case it could be inadvertently loaded in a new session, which isnt really suspicious, and the user shouldnt see a http error page.

It should be possible to check if there is a successful order by the user, and thank them again! 😉 Failing that, a “there is no checkout in progress” error message?

Steps to Reproduce

c.f. setup in https://github.com/django-oscar/django-oscar/issues/3421

Technical details

  • Python version: 3.8
  • Django version: 3.0
  • Oscar version: 2.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
solarissmokecommented, Sep 23, 2020

I agree that a 404 is not the correct response here, and can result in weird things happening if you have a proxy cache like Cloudflare, which will cache 404s for a short period. Not keen on 403 either because this will result in an unfriendly message to the user, and the odds are they are not trying something dodgy (e.g., it may just be a stale browser tab that has been reloaded).

I think we should probably 302 redirect to the home page/basket if we cannot find an order in the session.

0reactions
solarissmokecommented, Sep 23, 2020

Don’t think an error message is necessary tbh

Read more comments on GitHub >

github_iconTop Results From Across the Web

oscar.apps.checkout.views — django-oscar 2.1 documentation
[docs]class IndexView(CheckoutSessionMixin, generic.FormView): """ First page of the checkout. We prompt user to either sign in, or to proceed as a guest ...
Read more >
python - Page not found (404) Error in Django when creating a ...
So urls.py never finds the right route. And please urls.py: urlpatterns = [ ... path('create-checkout-session/<int:pk> ...
Read more >
Error 404 Page not found after checkout - WordPress.org
Please fill in the necessary data and click on the “Make your payment” button. You will get to a not found page.
Read more >
[Commerce JS] Checkout Returns 404 with Cart Not Found #659
CommerceJS does not allow to checkout the items, instead returns with 404. ❌ HTTP ERROR [404] Type: index.js?6741:1 Cart with ID "cart_id" not...
Read more >
Thank you page after checkout, on secondary language ...
When I make the payment in second language returns a 404 error because it sends in wrong permalink. I checked the store urls...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found