vendure-ecommerce/storefront-angular-starter

Issue for Demo Page

philipp-reich opened this issue ยท 3 comments

Hello guys,

first of all: GREAT JOB! ๐ŸŽ‰ i love it so much ๐Ÿ‘

i found an issue on the Demo Angular Storefront. when i selected a single product and continue to the "payment" view i got an error for "setShippingMethod"

{
  "operationName":"SetShippingMethod",
  "variables":{
    "id":"1"
  },
  "query":
    "mutation SetShippingMethod($id: ID!) {
        setOrderShippingMethod(shippingMethodId: $id) {
          ...Cart
        ...ErrorResult
        __typename
      }
    }

    fragment Cart on Order {
        ...    
    }

    fragment ErrorResult on ErrorResult {
        errorCode
      message
      __typename
    }"
}

Response message:

{
    "errors": [
        {
            "message": "Variable \"$id\" of type \"ID!\" used in position expecting type \"[ID!]!\".",
            "locations": [
                {
                    "line": 1,
                    "column": 28
                },
                {
                    "line": 2,
                    "column": 44
                }
            ]
        }
    ]
}

i had the same issue when i clone the repo and using the vendure 2.0.

my solution was to change the GraphQL mutation to:

export const SET_SHIPPING_METHOD = gql`
  mutation SetShippingMethod($id: [ID!]!) {
    setOrderShippingMethod(shippingMethodId: $id) {
      ...Cart
      ...ErrorResult
    }
  }
  ${CART_FRAGMENT}
  ${ERROR_RESULT_FRAGMENT}
`;

before: mutation SetShippingMethod($id: ID!) {
after: mutation SetShippingMethod($id: [ID!]!) {

Maybe it helps...

Hi, thanks for the report!
I'm a bit confused because that mutation did get updated: https://github.com/vendure-ecommerce/storefront-angular-starter/blob/master/src/app/checkout/components/checkout-shipping/checkout-shipping.graphql.ts#L55

but I just tested on the live demo and I get the same error, which makes me think the demo instance hasn't been updated.

But do you also get the error when you clone this repo locally?

Hey,
no. the local clone looks good. But tbh i checked only the repo on github. i updated my storefront from version 1 to 2. i didnt test it ๐Ÿ™ˆ

Thanks for the info! So I now updated the live demo, and it works now, so I'll close this issue.