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

NoMethodError in admin/order_cycles#index #2271

Closed
sauloperez opened this issue May 9, 2018 · 6 comments · Fixed by #2383
Closed

NoMethodError in admin/order_cycles#index #2271

sauloperez opened this issue May 9, 2018 · 6 comments · Fixed by #2383
Assignees
Labels
bug-s3 The bug is stopping a critical or non-critical feature but there is a usable workaround.

Comments

@sauloperez
Copy link
Contributor

sauloperez commented May 9, 2018

Description

Katuma's Bugsnag reported the following error a week ago.

captura de pantalla 2018-05-09 a les 15 19 36

Expected Behavior

At the point the OrderCycle model is used user should always be defined.

Actual Behavior

The app fails with the mentioned error when issuing the following request:

curl --request GET \
  --header 'Accept: application/json, text/javascript, */*' \
  --header 'X-Csrf-Token: 7xGaO9wLnV3Ey6PjKvrt9KY/4u+VXVpFEYZFAiERzaI=' \
  --header 'User-Agent: Mozilla/5.0 (Linux; Android 7.0; SM-J710F Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.126 Mobile Safari/537.36' \
  --header 'Referer: https://alpha.katuma.org/admin/order_cycles' \
  --header 'Accept-Encoding: gzip, deflate, br' \
  --header 'Accept-Language: es-ES,es;q=0.9' \
  --header 'Cookie: [FILTERED]' \
  'https://alpha.katuma.org/admin/order_cycles.json?ams_prefix=index&q%5Borders_close_at_gt%5D=Sun+Apr+01+2018+00:00:00+GMT%2B0200+(CEST)'

Steps to Reproduce

  1. Log in as admin
  2. Navigate to Order Cycles
  3. Clear session in browser manually
  4. Click "Show 30 more days"
  5. 💥

Severity

The reach of this bug is still unknown but doesn't seem to affect too many users, so severity 3.

Your Environment

  • Version used: v1.14
  • Browser name and version: Possibly Firefox
  • Operating System and version (desktop or mobile): Android
@sauloperez sauloperez added the bug-s3 The bug is stopping a critical or non-critical feature but there is a usable workaround. label May 9, 2018
@frank-west-iii
Copy link
Collaborator

frank-west-iii commented May 18, 2018

Seems like this might be related to a session timeout.

The problem lies in the order of execution for the before_filters:

prepend_before_filter :load_data_for_index, :only => :index

Due to the prepend we are executing the query before any auth happens. If we remove the prepend we get no error on the server, however, we don't get a great user experience either. They receive a console error and an infinite spinner. Not entirely sure why prepend was needed here so I am not sure removing it is completely safe. Seems to work though.

JSON requests that are unauthorized are returning html (the home page) instead of JSON with a 401 status.

There might be a way to override this behavior from Spree?

@sauloperez
Copy link
Contributor Author

great investigation @frank-west-iii ! I'm not sure what's best then here. Perhaps it's an error we can live with.

There might be a way to override this behavior from Spree?

These two words together (override and Spree) are terrifying :trollface:

@frank-west-iii
Copy link
Collaborator

Agree re: overriding Spree. 👍

@myriamboure
Copy link
Contributor

So what is the status for this bug @sauloperez @frank-west-iii do we move it forward? Leave with it and close? Or do something?

@frank-west-iii
Copy link
Collaborator

We could at least fix the error so it does not occur again.

The user will still not see any updates to their page when they click an action like "Show 30 more days". It will just fail silently for them. The user might then refresh their browser or take an action that will require them to log in again and the page will work again for them until they time out their session again 😄

The UX for it is not great, but that may be a more widespread issue across the application rather than this specific issue.

I can remove the error from our logs, but a much bigger conversation may need to be had about handling 401 errors across the application on AJAX requests.

@sauloperez
Copy link
Contributor Author

sauloperez commented Jun 13, 2018

The user will still not see any updates to their page when they click an action like "Show 30 more days". It will just fail silently for them. The user might then refresh their browser or take an action that will require them to log in again and the page will work again for them until they time out their session again

That sounds like a good trade-off to me. Can you work on it?

I can remove the error from our logs, but a much bigger conversation may need to be had about handling 401 errors across the application on AJAX requests.

Agree we need to review it but if we could live with it a bit longer... we have too many open 🔥 🔥

Proposals are welcome though @frank-west-iii :trollface:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-s3 The bug is stopping a critical or non-critical feature but there is a usable workaround.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants