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

No field of name "pageInfo" found on type "Metafield" in schema. No field of name "tags" found on type "Product" in schema #960

Closed
JeffJassky opened this issue Jul 6, 2023 · 2 comments

Comments

@JeffJassky
Copy link

JeffJassky commented Jul 6, 2023

Bug details

Describe the bug

While using the Shopify GraphQL API through the SDK, a new error is consistently surfacing that wasn't previously an issue. The error indicates a problem with the field 'pageInfo' on the type 'Metafield'. At the same time this error happened, the bug reported in #959 and #949 also happened. This application was working as expected until recently without any changes on our end. It appears a change or update on Shopify's end may have caused this new issue.

To Reproduce

The error arises every time we attempt a query involving the 'pageInfo' field on the type 'Metafield' or tags on Product type. The exact error message is:
No field of name "pageInfo" found on type "Metafield" in schema. and
No field of name "tags" found on type "Product" in schema

Unfortunately, I cannot provide the X-Request-ID as the errors are being handled within the SDK.

Expected behavior

Queries involving the 'pageInfo' field on 'Metafield' should function as they have in the past, without returning any errors. If changes have been made to the Shopify GraphQL API that affects these queries, they should be documented in the SDK's release notes or changelog.

Environment (please complete the following information):

  • OS: macOS, Ubuntu
  • Browser: Chrome, Firefox, IE, Edge
  • SDK Version: v2.20.0, v2.0.1 and others
@JeffJassky JeffJassky changed the title No field of name "pageInfo" found on type "Metafield" in schema. No field of name "pageInfo" found on type "Metafield" in schema. No field of name "tags" found on type "Product" in schema Jul 6, 2023
@JeffJassky
Copy link
Author

The problem:

All API versions before 2022-10 have been fully discontinued this week. Requests made to earlier versions are now processed by the oldest version that is currently supported, which is 2022-10. This means anything deprecated before 2022-10 has stopped working completelly.

The fix:

  1. Upgrade to the latest version of the library for best practices (2.20.0 as of this post).
  2. Update your GraphQL queries to remove references to deprecated data structures and replace them the newly available data structures.

To migrate metadata fields (for products, collections, etc), I have made these changes:

object.addConnection('metafields', {args: {first: 5}}, (metafield) => {
    metafield.add('namespace')
    metafield.add('key')
    metafield.add('value')
});

to:

  object.add('metafields', {
    args: {
      identifiers: [
        {
          key: "color",
          namespace: "extras"
        },
        {
          key: "size_chart",
          namespace: "extras"
        },
        {
          key: "temporary_collection",
          namespace: "my_fields"
        }
      ]
    }
  }, (metafield) => {
    metafield.add('key');
    metafield.add('namespace');
    metafield.add('value');
  });

and to migrate variant price and compareAtPrice I changed:

variant.add("price");
variant.add("compareAtPrice");

To:

variant.add('priceV2', (price) => {
    price.add('amount');
    price.add('currencyCode');
});
variant.add('compareAtPriceV2', (comparePrice) => {
    comparePrice.add('amount');
    comparePrice.add('currencyCode');
});

Unfortunately, ProductVariant.presentmentFields has been discontinued entirely and we are now supposed to use a different approach called @incontext, which is not yet supported by this library.

@JeffJassky
Copy link
Author

Marking closed.

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

No branches or pull requests

1 participant