500 error when using GraphQL API

Following query gives us 500 from Prismic GraphQL API when there are no matches for $page. Here show_in_pages is an array of page slugs for which we are matching.

When there are matching info articles, the response is returned as expected.

query PageInfoPopup($page: String!, $locale: String!) {
  prismic_allInfo_articles(
    sortBy: meta_firstPublicationDate_DESC
    lang: $locale
    first: 1
    where: { show_in_pages: { page_path: $page } }
  ) {
    edges {
      node {
        ...InfoArticleData
      }
      cursor
    }
    totalCount
  }
}

Hi @turkka.mannila,

Welcome to the Prismic community,
I will try to reproduce this issue, and in order to do so, can you please share with us (in a private message if necessary) your repository name with us.

It would be helpful if you could share a link to the GraphQL query applied in the GraphQL browser accessible at

https://your-repo-name.prismic.io/graphql

Looking forward to your reply,
Fares

Hi @turkka.mannila

I havn't received any private message from you or I have missed it!

Have you been able to fix this issue?

I recently ran into a similar issue. When querying for a document by id with a Prismic custom type that had no documents associated with it, the GraphQL endpoint returned a 500.

After creating one or more documents that use the same custom type, querying for a non-matching id would instead return a 200 with null data in the response body.

Thought I would share in case anyone runs into the same issue.

1 Like