Js-buy-sdk: 1.9.0 Error: Connections must include the selections "pageInfo { hasNextPage, hasPreviousPage }"

Created on 24 Oct 2018  路  5Comments  路  Source: Shopify/js-buy-sdk

Describe the bug

After upgrading to 1.9.0, client.checkout.create() now returns a rejected Promise with the below message:

Error: Connections must include the selections "pageInfo { hasNextPage, hasPreviousPage }"

Oddly enough, after inspecting the network request the response resolves with 200 and a normal payload.

After switching back to version 1.8.0, the error disappears.

To Reproduce

I'm calling client.checkout.create() within my codebase. client is created prior like this:

function buildClient(creds) {

  return client.buildClient({
    storefrontAccessToken: creds.js_access_token,
    domain: creds.domain
  });

}

X-Request-Id: f674ac87-ef23-4e4f-ba79-17b6e63cba80

Payload: {"data":{"checkoutCreate":{"userErrors":[],"checkout":{"id":"Z2lkOi8vc2hvcGlmeS9DaGVja291dC9lYmYzNWY5MmE4ZTIwMzkwYjZkNDI1MmU4MTUyOTE3Nj9rZXk9NjFjY2ExMWMwN2Q0OWJkMmMxMTdmNGMxMTJkOTk5ZWQ=","ready":true,"requiresShipping":false,"note":null,"paymentDue":"0.00","webUrl":"https://wpslitetest10.myshopify.com/24007681/checkouts/ebf35f92a8e20390b6d4252e81529176?key=61cca11c07d49bd2c117f4c112d999ed","orderStatusUrl":null,"taxExempt":false,"taxesIncluded":false,"currencyCode":"USD","totalTax":"0.00","subtotalPrice":"0.00","totalPrice":"0.00","completedAt":null,"createdAt":"2018-10-23T22:32:07Z","updatedAt":"2018-10-23T22:32:07Z","email":null,"discountApplications":{"edges":[]},"shippingAddress":null,"shippingLine":null,"customAttributes":[],"order":null,"lineItems":{"pageInfo":{"hasNextPage":false,"hasPreviousPage":false},"edges":[]}}}}}

Expected behavior
Calling client.checkout.create() should return a new / existing checkout.

Environment (please complete the following information):

  • OS: macOS 10.13.6
  • Browser Chrome 70.0.3538.67
  • SDK Version 1.9.0

Additional context
As I mentioned, downgrading to version 1.8.0 seemed to fix the issue for me.

ezgif com-optimize

Bug Report Checklist

  • [x] I have read and agree to the CODE_OF_CONDUCT.md
  • [x] I have read the CONTRIBUTING.md guidelines.
  • [x] I have provided a detailed description of the bug, including code samples, and/or network data.
  • [x] I have provided information about my development environment, including SDK version.

Most helpful comment

Thanks for flagging this. I'm am currently working on a fix.

All 5 comments

Same issue here.

Same issues here.

Also, when I try to add a product to my cart I get the following error:

TypeError: Cannot read property 'checkoutLineItemsAdd' of undefined
    at index.js:3573

This is the code that causes the error:

addLineItemToCart = ({ quantity, variantId }) => {
  const { checkout } = this.state;
  const lineItem = { quantity: parseInt(quantity, 10), variantId };

  return this.shopifyClient.checkout.addLineItems(checkout.id, [lineItem])
    .then((newCheckout) => {
      this.updateCheckout(newCheckout);
    })
    .catch(console.error);
};

Problems disappear when I downgrade to 1.8.0.

Thanks for flagging this. I'm am currently working on a fix.

A fix has been shipped in version 1.9.1 #571 . Please let me know if you continue to experience any issues.

Confirmed fixed. Thanks for the quick turnaround! @rebeccajfriedman 鈿★笍

Was this page helpful?
0 / 5 - 0 ratings