Skip to content
This repository has been archived by the owner on Dec 19, 2019. It is now read-only.

Selecting selected_shipping_methods when there's none configured results in an Internal Server Error #874

Closed
dplaton opened this issue Aug 30, 2019 · 2 comments
Assignees

Comments

@dplaton
Copy link

dplaton commented Aug 30, 2019

Preconditions (*)

  1. Magento 2.3.2
  2. PHP 7.2

Steps to reproduce (*)

  1. Create a guest cart using the createGuestCart mutation
  2. Add a shipping address to the cart
  3. Perform the following query:
query {
  cart(cart_id: "your cart id") {
    shipping_addresses {
  	available_shipping_methods {
      carrier_code
    }
      selected_shipping_method {
        carrier_code
        carrier_title
        method_code
        method_title
      }
    }
  }
}

Expected result (*)

  1. The selected shipping method is empty/null
  2. The available shipping methods object to contain the correct carrier codes configured

Actual result (*)

An error is returned:

{
  "errors": [
    {
      "message": "Internal server error",
      "category": "internal",
      "locations": [
        {
          "line": 7,
          "column": 7
        }
      ],
      "path": [
        "cart",
        "shipping_addresses",
        0,
        "selected_shipping_method"
      ]
    }
  ],
  "data": {
    "cart": {
      "shipping_addresses": [
        {
          "available_shipping_methods": [
            {
              "carrier_code": "flatrate"
            }
          ],
          "selected_shipping_method": null
        }
      ]
    }
  }
}

Note that this error does not occur when we only select the selected_shipping_methods (without the available_shipping_methods), so a query like

query {
  cart(cart_id: "Kuvi8t2mSaqeh8pkWBnLXXmqQnkLu0Tr") {
    shipping_addresses {
      selected_shipping_method {
        carrier_code
        carrier_title
        method_code
        method_title
      }
    }
  }
}

returns the expected result.

This issue looks a lot like #665 and according to (#665 (comment)) it should've been investigated. However, I couldn't find and PR to fix it.

@dplaton dplaton changed the title Selected selected_shipping_methods when there's none configured results in an Internal Server Error Selecting selected_shipping_methods when there's none configured results in an Internal Server Error Aug 30, 2019
@lenaorobei
Copy link
Contributor

In progress by internal team.

@lenaorobei
Copy link
Contributor

Fixed.

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

No branches or pull requests

3 participants