App: Product page shows empty when connect to Shopify API

Solved
Inbase_Vincent
New Member
4 0 0

Our app has encountered an error while attempting to connect to the API, causing our product page to be empty.

Although the web version is working fine, the app is currently facing this problem.

We would greatly appreciate your guidance on resolving this issue.
Error code:

{"errors":[{"message":"Field 'products' doesn't exist on type 'Shop'","locations":[{"line":1,"column":7}],"path":["query","shop","products"],"extensions":{"code":"undefinedField","typeName":"Shop","fieldName":"products"}}]}

{"errors":[{"message":"Field 'collections' doesn't exist on type 'Shop'","locations":[{"line":1,"column":7}],"path":["query","shop","collections"],"extensions":{"code":"undefinedField","typeName":"Shop","fieldName":"collections"}},{"message":"Field 'articles' doesn't exist on type 'Shop'","locations":[{"line":1,"column":393}],"path":["query","shop","articles"],"extensions":{"code":"undefinedField","typeName":"Shop","fieldName":"articles"}}]}

Accepted Solution (1)
Liam
Shopify Staff
Shopify Staff
1882 199 575

This is an accepted solution.

Hi Inbase_Vincent,

 

The error messages you're seeing indicate that the 'products', 'collections', and 'articles' fields do not exist on the 'Shop' type in the GraphQL schema you're using to query data.

 

Here are some things you can try to resolve the issue:

  1. Check your GraphQL schema: Make sure the GraphQL schema you're using supports the 'products', 'collections', and 'articles' fields on the 'Shop' type. Not all versions of Shopify's API support all fields. You can check the documentation for your specific API version to see if these fields are supported.

  2. Check your access scopes: Make sure your app has the necessary access scopes to retrieve product, collection, and article data. If your app does not have the required permissions, you will not be able to access these fields. You can check and update your app's access scopes in the Shopify admin.

  3. Check your query syntax: Make sure your GraphQL queries are correctly formatted. It's possible that a typo or syntax error in your query is causing this issue.

Here is an example of how you should structure your query:

{
  shop {
    name
    products(first: 10) {
      edges {
        node {
          title
          id
        }
      }
    }
  }
}

Try the above troubleshooting approaches and let us know if you're still seeing issues,

 

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

View solution in original post

Replies 2 (2)
Liam
Shopify Staff
Shopify Staff
1882 199 575

This is an accepted solution.

Hi Inbase_Vincent,

 

The error messages you're seeing indicate that the 'products', 'collections', and 'articles' fields do not exist on the 'Shop' type in the GraphQL schema you're using to query data.

 

Here are some things you can try to resolve the issue:

  1. Check your GraphQL schema: Make sure the GraphQL schema you're using supports the 'products', 'collections', and 'articles' fields on the 'Shop' type. Not all versions of Shopify's API support all fields. You can check the documentation for your specific API version to see if these fields are supported.

  2. Check your access scopes: Make sure your app has the necessary access scopes to retrieve product, collection, and article data. If your app does not have the required permissions, you will not be able to access these fields. You can check and update your app's access scopes in the Shopify admin.

  3. Check your query syntax: Make sure your GraphQL queries are correctly formatted. It's possible that a typo or syntax error in your query is causing this issue.

Here is an example of how you should structure your query:

{
  shop {
    name
    products(first: 10) {
      edges {
        node {
          title
          id
        }
      }
    }
  }
}

Try the above troubleshooting approaches and let us know if you're still seeing issues,

 

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Inbase_Vincent
New Member
4 0 0

Hi Liam,

Thanks for your reply. 
We will follow your comments to re-try and see if it works.