Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

[Urgent] Receiving an error while using Shopify's GraphQL API to fetch products

[Urgent] Receiving an error while using Shopify's GraphQL API to fetch products

FP_DEV
Tourist
4 0 1
Hey!

We are using a GraphQL API to access Shopify on our own website. However, since 8.30 pm IST (Indian Standard Time) the API seems to have stopped working and our product pages on the website appear blank. Did something change on Shopify's end?
 
This is extremely urgent for us as we are launching a very important campaign tomorrow. So it's very urgent.
 
Since the code was working as expected until 8.30 pm IST. We are confident it is not an issue from our code. This is the library we are using -  npmjs (dot) com/package/graphql-js-client
This is the API response we receive:

 

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

 

Replies 5 (5)

SBD_
Shopify Staff
1831 273 423

Hey @FP_DEV 

 

Can you confirm the query please? The response suggests the query might be structured `{ shop { products {` instead of simply `{ products {`.

Scott | Developer Advocate @ Shopify 

FP_DEV
Tourist
4 0 1

Heyy SBD_


Yes, It was structured as `{ shop { products {`.

We were able to use this structure until yesterday without any problems.

ShopifyDevSup
Shopify Staff
1453 239 532

Hi @FP_DEV 👋
 

It's unclear which schema and version is being used here. Currently, neither Admin API nor SFAPI have stable versions that support a `products` field/connection on the `shop` object. Querying `products` on the root will resolve this error: `{ products (first:10) { ... } }`.

 

Hope that helps!
 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us 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

FP_DEV
Tourist
4 0 1

Hey @ShopifyDevSup,

Can you also help me understand why this would suddenly happen and stop working, irrespective of the schema and the version?

 

The website was working fine one minute and then all the product pages stopped working all of a sudden. We have been using this library for over a year now. -> npmjs(dot)com/package/graphql-js-client

ShopifyDevSup
Shopify Staff
1453 239 532

Hey @FP_DEV ,

I definitely get where you're coming from here, this would for sure be frustrating - especially if it's functionality your app depends on, so I just wanted to say thank you for bearing with us here. I also just want to clarify what we're seeing on our end. As mentioned in our earlier reply here, the 'products' field under the 'shop' object isn't officially supported in the stable versions of either the Admin API or the Storefront API. This is likely the root cause of the issue you're reporting.


It may have been working previously due to to various reasons (generally, legacy functionality/dependency retention), but if a specific functionality isn't documented in our developer documentation and officially supported, it can change without notice. This instability/change without notice method also applies to the unstable version of the API as well - so I just wanted to mention that
 

We recommend sticking to the officially documented fields and structures for your production apps/integrations as this is the best way to ensure the stability and reliability of your apps/functionality. As we mentioned, querying products on the root of your query is the best way to grab specific product information currently, but since you're using the Node library, another place you may want to reach out to for potential further information would be the official Github repo for the Node.js library here. I'd recommend opening an issue on that repo, in case anything has changed with the Node library itself recently. 

 

Hope this helps and thanks again for reaching out

 

Al | Shopify Developer Support

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us 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