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

500 Error on Payment Methods Report #5572

Closed
lin-d-hop opened this issue Jun 9, 2020 · 7 comments · Fixed by #5573
Closed

500 Error on Payment Methods Report #5572

lin-d-hop opened this issue Jun 9, 2020 · 7 comments · Fixed by #5573
Assignees
Labels
bug-s2 The bug is affecting any of the non-critical features described in S1 and there is no workaround.

Comments

@lin-d-hop
Copy link
Contributor

lin-d-hop commented Jun 9, 2020

Description

The Order Cycle Management -> Payments Methods report loads all orders before even loading the filter/search page.

To find Payments Methods it uses a line:
pm = o.payments.first.payment_method -> payment.first is nil

If ONE order that is available to the user from ANY of their enterprises fails to find a payment method then the whole page crashes - 500Error:
undefined method payment_method' for nil:NilClass`

Bugsnag: https://app.bugsnag.com/yaycode/openfoodnetwork-uk/errors/5ea17c7622a1830018e1f834?filters[event.since][0]=30d&filters[error.status][0]=open

Since the system allows an order without a payment (?) we need this report to run regardless.

Expected Behavior

The report, ya know, works.

Actual Behaviour

SLUG

Steps to Reproduce

I have not been able to track down the enterprise that this order is associated with yet - but ther user [email protected] is associated with it. This user is the one I use for all reports integrations.

  1. Logged in as a user associated with an order without a payment
  2. Go to Payment Methods report
  3. Slug! (500 error)

Animated Gif/Screenshot

Workaround

Severity

bug-s2: a non-critical feature is broken, no workaround

Your Environment

  • Version used: 2.10.0
  • Browser name and version:
  • Operating System and version (desktop or mobile):

Possible Fix

From @luisramos0 on Slack:
Should be very easy to address (like this o.payments.first&.payment_method)

@lin-d-hop lin-d-hop added the bug-s2 The bug is affecting any of the non-critical features described in S1 and there is no workaround. label Jun 9, 2020
@Matt-Yorkley Matt-Yorkley self-assigned this Jun 9, 2020
@kirstenalarsen
Copy link
Contributor

is this the same thing? #4977

@RachL
Copy link
Contributor

RachL commented Jun 10, 2020

@kirstenalarsen Well what I understand is that in @lin-d-hop 's case it's a super user that has the problem and not one enterprise in particular, which makes it difficult to find the order causing this.

That's the difference I see between the two. But maybe I've missunderstood.

@lin-d-hop
Copy link
Contributor Author

Definitely not related to #4977.

Payment Totals report is not the Order Cycle Management -> Payment Methods report.

@RachL
Copy link
Contributor

RachL commented Jun 10, 2020

@lin-d-hop it's not the same report, but I think it is the same cause: some corrupt data.

@lin-d-hop
Copy link
Contributor Author

lin-d-hop commented Jun 10, 2020

Could well be related and due to an order not having a payment associated:
From Payments Report code ->
payments.first.payment_method.name

The key difference is that the data is loaded before the page renders so the corrupted order makes the page totally unusable for any user associated with the order.

@lin-d-hop
Copy link
Contributor Author

Hey team, I'm hoping this can get into the next release please?

@sauloperez
Copy link
Contributor

It made it to test ready so it should be tested by today or tomorrow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-s2 The bug is affecting any of the non-critical features described in S1 and there is no workaround.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants