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

[Stripe/active_merchant] Checkout error prevents order completion #9580

Closed
filipefurtad0 opened this issue Aug 19, 2022 · 5 comments · Fixed by #9585
Closed

[Stripe/active_merchant] Checkout error prevents order completion #9580

filipefurtad0 opened this issue Aug 19, 2022 · 5 comments · Fixed by #9585
Assignees
Labels
bug-s2 The bug is affecting any of the non-critical features described in S1 and there is no workaround. regression Tagging any identified regressions

Comments

@filipefurtad0
Copy link
Contributor

filipefurtad0 commented Aug 19, 2022

Description

Probably introduced by #9507 and/or #9456.

Since the last release we're getting errors on some instances:
lib/active_merchant/billing/gateways/stripe_payment_intents_decorator.rb:60

UK
https://app.bugsnag.com/yaycode/openfoodnetwork-uk/errors/62fb43b59ffd5b0008478b23?filters[event.since]=all&filters[search][]=undefined&filters[search][]=method&filters[search][]=%60first%27&filters[search][]=for&filters[search][]=nil%3ANilClass

AU
https://app.bugsnag.com/yaycode/openfoodnetwork-aus/errors/62fc74ff173ec3000888a0ec?filters[event.since]=30d&filters[app.release_stage]=production

US
https://app.bugsnag.com/yaycode/openfoodnetwork-usa/errors/62fbeb745f03710008c2983d?filters[event.since]=30d&filters[error.status]=open

This is preventing checkout for some customers. The "Checkout failed" flash message is displayed.

Expected Behavior

Checkout succeeds and the credit card is saved in the profile.

Actual Behaviour

Error at checkout prevents completing the order.

Steps to Reproduce

Saving a new card during checkout:

  • Log in as user.
  • Add items to cart.
  • Check out with Stripe and tick "Remember this card?".
  • Submit with "Place order now".

Animated Gif/Screenshot

image

Workaround

  • Untick "Remember this card?" or
  • use another payment method other than Stripe.

Severity

Your Environment

  • Version used: v4.2.9
  • Browser name and version: -
  • Operating System and version (desktop or mobile): -

Possible Fix

To be checked: The fact that it is so far not observed in FR could indicate that the bug affects only cards not requiring SCA?

@filipefurtad0 filipefurtad0 added bug-s2 The bug is affecting any of the non-critical features described in S1 and there is no workaround. regression Tagging any identified regressions labels Aug 19, 2022
@mkllnk
Copy link
Member

mkllnk commented Aug 22, 2022

The fact that it is so far not observed in FR could indicate that the bug affects only cards not requiring SCA?

No, it confirms that the release introduced the bug because I didn't deploy to FR.

@mkllnk mkllnk self-assigned this Aug 22, 2022
@mkllnk
Copy link
Member

mkllnk commented Aug 22, 2022

This issue has been linked to an error in Bugsnag
NoMethodError in checkout#update

@mkllnk
Copy link
Member

mkllnk commented Aug 22, 2022

An error linked to this issue has been marked as fixed in Bugsnag
NoMethodError in checkout#update

@mkllnk
Copy link
Member

mkllnk commented Aug 22, 2022

@filipefurtad0
Copy link
Contributor Author

filipefurtad0 commented Sep 6, 2022

Looking at logs to see what actually blows up:

openfoodnetwork@staging:~/apps/openfoodnetwork/current$ tail -f log/staging.log

I, [2022-09-06 15:24:12#27524]  INFO -- : source=rack-timeout id=556ac606-e827-4723-b789-ad9bbef9ace0 wait=5ms timeout=120000ms state=ready
I, [2022-09-06 15:24:12#27524]  INFO -- : Started PUT "/checkout.json" for 148.69.190.53 at 2022-09-06 15:24:12 +0000
I, [2022-09-06 15:24:12#27524]  INFO -- : Processing by CheckoutController#update as JSON
I, [2022-09-06 15:24:12#27524]  INFO -- :   Parameters: {"order"=>{"default_bill_address"=>false, "default_ship_address"=>false, "email"=>"[email protected]", "shipping_method_id"=>902, "payments_attributes"=>[{"payment_method_id"=>"751", "source_attributes"=>{"gateway_payment_profile_id"=>"pm_1Lf3dHFBE7f7kItLsqD3Cukb", "cc_type"=>"visa", "last_digits"=>"3184", "month"=>2, "year"=>2034, "first_name"=>"Frank", "last_name"=>"Four Fingers", "save_requested_by_customer"=>true}}], "bill_address_attributes"=>{"zipcode"=>"987654", "city"=>"city", "state_name"=>"MB", "state_id"=>57, "phone"=>"987651", "firstname"=>"Frank", "lastname"=>"Four Fingers", "address1"=>"rua da gloria, 28", "address2"=>"", "country_id"=>204, "country_name"=>"Canada"}, "ship_address_attributes"=>{"zipcode"=>"987654", "city"=>"city", "state_name"=>"MB", "state_id"=>57, "phone"=>"987651", "firstname"=>"Frank", "lastname"=>"Four Fingers", "address1"=>"rua da gloria, 28", "address2"=>"", "country_id"=>204, "country_name"=>"Canada"}, "terms_and_conditions_accepted"=>true}, "checkout"=>{"order"=>{"default_bill_address"=>false, "default_ship_address"=>false, "email"=>"[email protected]", "shipping_method_id"=>902, "payments_attributes"=>[{"payment_method_id"=>"751", "source_attributes"=>{"gateway_payment_profile_id"=>"pm_1Lf3dHFBE7f7kItLsqD3Cukb", "cc_type"=>"visa", "last_digits"=>"3184", "month"=>2, "year"=>2034, "first_name"=>"Frank", "last_name"=>"Four Fingers", "save_requested_by_customer"=>true}}], "bill_address_attributes"=>{"zipcode"=>"987654", "city"=>"city", "state_name"=>"MB", "state_id"=>57, "phone"=>"987651", "firstname"=>"Frank", "lastname"=>"Four Fingers", "address1"=>"rua da gloria, 28", "address2"=>"", "country_id"=>204, "country_name"=>"Canada"}, "ship_address_attributes"=>{"zipcode"=>"987654", "city"=>"city", "state_name"=>"MB", "state_id"=>57, "phone"=>"987651", "firstname"=>"Frank", "lastname"=>"Four Fingers", "address1"=>"rua da gloria, 28", "address2"=>"", "country_id"=>204, "country_name"=>"Canada"}, "terms_and_conditions_accepted"=>true}}}
W, [2022-09-06 15:24:13#27524]  WARN -- [Bugsnag]: Adding metadata/severity using a hash is no longer supported, please use block syntax instead
I, [2022-09-06 15:24:13#27524]  INFO -- [Bugsnag]: Notifying https://notify.bugsnag.com of NoMethodError
I, [2022-09-06 15:24:13#27524]  INFO -- : Completed 400 Bad Request in 1051ms (Views: 0.2ms | ActiveRecord: 115.9ms | Allocations: 137973)
I, [2022-09-06 15:24:13#27524]  INFO -- : source=rack-timeout id=556ac606-e827-4723-b789-ad9bbef9ace0 wait=5ms timeout=120000ms service=1087ms state=completed

As seen on bugsnag (request):

body

{
  "order": {
    "default_bill_address": false,
    "default_ship_address": false,
    "email": "[email protected]",
    "shipping_method_id": 902,
    "payments_attributes": [
      {
        "payment_method_id": "751",
        "source_attributes": {
          "gateway_payment_profile_id": "pm_1Lf3dHFBE7f7kItLsqD3Cukb",
          "cc_type": "visa",
          "last_digits": "3184",
          "month": 2,
          "year": 2034,
          "first_name": "Frank",
          "last_name": "Four Fingers",
          "save_requested_by_customer": true
        }
      }
    ],
    "bill_address_attributes": {
      "zipcode": "987654",
      "city": "city",
      "state_name": "MB",
      "state_id": 57,
      "phone": "987651",
      "firstname": "Frank",
      "lastname": "Four Fingers",
      "address1": "rua da gloria, 28",
      "address2": "",
      "country_id": 204,
      "country_name": "Canada"
    },
    "ship_address_attributes": {
      "zipcode": "987654",
      "city": "city",
      "state_name": "MB",
      "state_id": 57,
      "phone": "987651",
      "firstname": "Frank",
      "lastname": "Four Fingers",
      "address1": "rua da gloria, 28",
      "address2": "",
      "country_id": 204,
      "country_name": "Canada"
    },
    "terms_and_conditions_accepted": true
  }
}

clientIp

148.69.190.53

headers

{
  "Version": "HTTP/1.1",
  "X-Real-Ip": "148.69.190.53",
  "X-Forwarded-For": "148.69.190.53",
  "Host": "staging.openfoodnetwork.org.uk",
  "X-Forwarded-Proto": "https",
  "X-Request-Start": "t=1662477852.123",
  "Connection": "close",
  "Content-Length": "930",
  "User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:104.0) Gecko/20100101 Firefox/104.0",
  "Accept": "application/json, text/javascript, */*",
  "Accept-Language": "en-US,en;q=0.5",
  "Accept-Encoding": "gzip, deflate, br",
  "Referer": "https://staging.openfoodnetwork.org.uk/checkout",
  "X-Requested-With": "XMLHttpRequest",
  "Content-Type": "application/json;charset=utf-8",
  "X-Xsrf-Token": "OTGpNJxZ6Dxnk1PQDrSZIKvlx17rEy1KX_y1IPfM28rCuLyHTxA_cWPVuAVztAWfWANxiFwjXaz4WJ2S975pvw",
  "Origin": "https://staging.openfoodnetwork.org.uk",
  "Dnt": "1",
  "Sec-Fetch-Dest": "empty",
  "Sec-Fetch-Mode": "cors",
  "Sec-Fetch-Site": "same-origin",
  "Cookie": "[FILTERED]"
}

httpMethod

PUT

httpVersion

HTTP/1.1

params

{
  "order": {
    "default_bill_address": false,
    "default_ship_address": false,
    "email": "[email protected]",
    "shipping_method_id": 902,
    "payments_attributes": [
      {
        "payment_method_id": "751",
        "source_attributes": {
          "gateway_payment_profile_id": "pm_1Lf3dHFBE7f7kItLsqD3Cukb",
          "cc_type": "visa",
          "last_digits": "3184",
          "month": 2,
          "year": 2034,
          "first_name": "Frank",
          "last_name": "Four Fingers",
          "save_requested_by_customer": true
        }
      }
    ],
    "bill_address_attributes": {
      "zipcode": "987654",
      "city": "city",
      "state_name": "MB",
      "state_id": 57,
      "phone": "987651",
      "firstname": "Frank",
      "lastname": "Four Fingers",
      "address1": "rua da gloria, 28",
      "address2": "",
      "country_id": 204,
      "country_name": "Canada"
    },
    "ship_address_attributes": {
      "zipcode": "987654",
      "city": "city",
      "state_name": "MB",
      "state_id": 57,
      "phone": "987651",
      "firstname": "Frank",
      "lastname": "Four Fingers",
      "address1": "rua da gloria, 28",
      "address2": "",
      "country_id": 204,
      "country_name": "Canada"
    },
    "terms_and_conditions_accepted": true
  },
  "controller": "checkout",
  "action": "update",
  "format": "json",
  "checkout": {
    "order": {
      "default_bill_address": false,
      "default_ship_address": false,
      "email": "[email protected]",
      "shipping_method_id": 902,
      "payments_attributes": [
        {
          "payment_method_id": "751",
          "source_attributes": {
            "gateway_payment_profile_id": "pm_1Lf3dHFBE7f7kItLsqD3Cukb",
            "cc_type": "visa",
            "last_digits": "3184",
            "month": 2,
            "year": 2034,
            "first_name": "Frank",
            "last_name": "Four Fingers",
            "save_requested_by_customer": true
          }
        }
      ],
      "bill_address_attributes": {
        "zipcode": "987654",
        "city": "city",
        "state_name": "MB",
        "state_id": 57,
        "phone": "987651",
        "firstname": "Frank",
        "lastname": "Four Fingers",
        "address1": "rua da gloria, 28",
        "address2": "",
        "country_id": 204,
        "country_name": "Canada"
      },
      "ship_address_attributes": {
        "zipcode": "987654",
        "city": "city",
        "state_name": "MB",
        "state_id": 57,
        "phone": "987651",
        "firstname": "Frank",
        "lastname": "Four Fingers",
        "address1": "rua da gloria, 28",
        "address2": "",
        "country_id": 204,
        "country_name": "Canada"
      },
      "terms_and_conditions_accepted": true
    }
  }
}

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. regression Tagging any identified regressions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants