Graphql query: doesn't return any data with slices

Hello Prismic people!

Trying to fetch my Prismic sliced data.

Query is quite simple:

query MyQuery {
  allPrismicArticles(filter: {uid: {eq: "article-1"}}) {
edges {
  node {
    data {
      body {
        ... on PrismicArticlesBodyText {
          id
          primary {
            text {
              html
              text
              raw
            }}}}}}}}}

But somehow explorer returns me just this:

{
  "data": {
    "allPrismicArticles": {
      "edges": []
    }
  },
  "extensions": {}
}

You can see it here:

What am I doing wrong?

If I made query like this (without slices):

query MyQuery {
  allPrismicArticle {
    edges {
      node {
        data {
          body {
            primary {
              text {
                text
              }
            }
          }
        }
      }
    }
  }
}

... correct data will return:

1 Like

Hello! Could you share your repository URL?

Sure https://github.com/sidorovanthon/nutriklinika/

1 Like

Sorry, didn't commit last changes with slices.
Now it's done, you can see.

1 Like

Great news! That was confusing me :smile:

1 Like

Guys any ideas?
Maybe someone solved same problem before?

Hey @a11,

Thanks for posting this question! I notice that your first GraphQL query (the one that doesn't work) begins:

allPrismicArticles(filter: {uid: {eq: "article-1"}}) {

Your second query (the one that works) begins:

allPrismicArticle {

The first has an s and the second does not. I downloaded your repo and recreated everything, and if I use allPrismicArticle, without the s, it works perfectly for me.

I hope I understood your issue properly. Please let me know if this solves the issue! If not, let me know, and I'll keep digging :slight_smile:

Best,
Sam