Document missing from GraphQL Response

I have a document that is now missing from specific graphQL queries. My client edited the document last week, and after saving/publishing again, the document stopped showing up in one specific query. Before they had made the edit there was no issue. When I look at the response data from the query the document is missing entirely. This only started happening after the client made the edit last week.

I've edited other documents and have had no issues. I've tried to duplicate the document to see if that would appear in the query response, but it is also missing.

Any thoughts on what could be happening? This only started after the AWS outage.

Hi @kristen

Thanks for reaching out.

Normally all issues related to the AWS outage have been resolved, so to investigate this issue, we would need some extra information like the repository name you are using and some example documents and GraphQL queries that have missing documents.

We've built a headless ecommerce site for our client. In Prismic, there are three custom types related to this problem: Categories, Product Types and Products.

Product Types like "Cleanser" or "Serum" belong to a Category called "Skincare". Others like "Shampoo" or "Conditioner" belong to a Category called "Body/Wellness"

In effect:

  • Products belong to Product Types.
  • Product Types belong to Categories
  • Categories have many Products through Product Types.

We have Product Landing Pages for both Product Types and Categories, each showing products related to that Type.

The problem in question is that specific products are missing when I view the category landing page, but not when I view the Product Type Landing page.

The products show up when viewing the Product Type Landing Page, but they do not show up when viewing the Shop Category landing page.

I've verified that there isn't any front-end code that's filtering out the products in question. They're simply not present in our Prismic GraphQL response.

The code to get the Product Type LP products works like this:

const fetchProductTypeProducts = gql` 
 query($cursor: String!, $uid: String!, $numResults: Int!) {
  allProducts(
    after: $cursor
    first: $numResults
    where: { product_type: $uid }
  ) {
  title
  //
 }`

// then in another file, we use the query like so.
// this works as expected. 
const { data } = await prismicClient.query({ 
  query: fetchProductTypeProducts, 
  variables: {uid: uid, cursor: cursor} 
})

The code for the Categories Landing Pages works a little differently. Each Category has X number of Product Types. So we map over an array of Product Types in the Category and run the query above, like so:

const productData = await Promise.all(
    productTypes.map(async prodType => {
      return (
        await prismicClient.query({
          query: fetchProductTypeProducts,
          variables: { uid: prodType.id, cursor: cursor },
        })
      ).data
    })
  )

So in effect, the same query is being run both the Product Type Landing Page and the Shop Category Landing Page. But on the Shop Category Landing Page, a few, specific products are not being returned from Prismic.

My repository name is gee-beauty. I can also provide you with the specific document IDs that are missing from the Shop Category Landing Page, if that would help!

Thank you!

Hi @kristen,

Thanks for the extensive explanation, I will try to troubleshoot this issue with you.

Can you please rewrite your query in the Prismic GraphQL browser and see if the document is missing there? you can access the GraphQL browser using this link

Looking forward to your replay,
Fares

Hey @Fares, thanks for your prompt to use the GraphQL Browser. With some fresh eyes after the holidays, I realized I wasn't paginating my queries when loading the Shop Category landing page. As such, my query was only returning the first 20 products inside the Product Types in that Shop Category.

This mistake was not happening when loading the Product Type landing page.

1 Like

Thanks for letting us know, glad you found the solution :grinning: