Error when querying a slice with graphQuery

hi,
:sos: when I use this query :
...
const menuQuery={ menuDemo { ...on menu_links { non-repeat { ...non-repeatFields } } } }

i have this error 

Server Error
Error: Unable to parse fetch query Invalid fetch parsing Exception.

Invalid input ' ', expected AlphaNum, AlphaChar, '_', '-' or test (line 3, column 10):
...on menu_links {
^

5 rules mismatched at error location:
...bracketed/ /$anonfun/ +:-9 /Relation/ |:-5 /Fragment/ /FragmentName/ /Key/ capture:-2 / +:-2 / | / AlphaNum:
...racketed/ /$anonfun/ +:-9 /Relation/ |:-5 /Fragment/ /FragmentName/ /Key/ capture:-2 / +:-2 / | / AlphaChar:
...nonfun/ +:-24 /Doc/ /bracketed/ /$anonfun/ +:-9 /Relation/ |:-5 /Fragment/ /FragmentName/ /Key/ capture:-2 / +:-2 / | / '_'
...nonfun/ +:-24 /Doc/ /bracketed/ /$anonfun/ +:-9 /Relation/ |:-5 /Fragment/ /FragmentName/ /Key/ capture:-2 / +:-2 / | / '-'
...s/ /bracketed/ /$anonfun/ +:-24 /Doc/ /bracketed/ /$anonfun/ +:-9 /Relation/ |:-5 /Fragment/ /FragmentName/ / test

This error happened while generating the page. Any console logs will be displayed in the terminal window.
Source
pages/index.js (51:76) @ async getStaticProps

49 |
50 | const doc = await client.getSingle("homepage", { lang: locale });

51 | const menu = await client.getSingle("menuDemo", {lang: locale , graphQuery : menuQuery});
| ^
52 |
53 | return {
54 | props: {
Show collapsed frames

Hello @loudmu

Welcome to the Prismic community, and thanks for reaching out to us.

All slices come under body object by default. You have to mention body object too to retrieve the Slices. So, your query should look like this:

const menuQuery= { menuDemo { body { ...on menu_links { non-repeat { ...non-repeatFields } } } } }

Find more details in our graphQuery article.

Thanks,
Priyanka

thank you for your fast answer,but unfortunately it doesn't work
the message is;

Server Error
Error: Unable to parse fetch query Invalid fetch parsing Exception.

Invalid input ' ', expected '\r' or '\n' (line 1, column 2):
{ menuDemo { body { ...on menu_links { non-repeat { ...non-repeatFields } } } } }
 ^

2 rules mismatched at error location:
  /InputLine/ /Docs/ /bracketed/ /NewLine/ ? / '\r'
  /InputLine/ /Docs/ /bracketed/ /NewLine/ '\n'


when I query menudemo without the graphQuery the response is

{
  id: 'YjE51RAAACEAhq8s',
  uid: null,
  url: null,
  type: 'menuDemo',
  href: 'https://conseiller.cdn.prismic.io/api/v2/documents/search?ref=YjFABxAAACIAhsq9&q=%5B%5B%3Ad+%3D+at%28document.id%2C+%22YjE51RAAACEAhq8s%22%29+%5D%5D',
  tags: [],
  first_publication_date: '2022-03-16T01:14:10+0000',
  last_publication_date: '2022-03-16T01:40:23+0000',
  slugs: [ 'menu-demo' ],
  linked_documents: [],
  lang: 'en-ca',
  alternate_languages: [ { id: 'YjE31hAAACEAhqZZ', type: 'menuDemo', lang: 'fr-ca' } ],
  data: { title: [ [Object] ], slices: [ [Object], [Object], [Object] ] }
}
{
  id: 'YjE51RAAACEAhq8s',
  uid: null,
  url: null,
  type: 'menuDemo',
  href: 'https://conseiller.cdn.prismic.io/api/v2/documents/search?ref=YjFABxAAACIAhsq9&q=%5B%5B%3Ad+%3D+at%28document.id%2C+%22YjE51RAAACEAhq8s%22%29+%5D%5D',
  tags: [],
  first_publication_date: '2022-03-16T01:14:10+0000',
  last_publication_date: '2022-03-16T01:40:23+0000',
  slugs: [ 'menu-demo' ],
  linked_documents: [],
  lang: 'en-ca',
  alternate_languages: [ { id: 'YjE31hAAACEAhqZZ', type: 'menuDemo', lang: 'fr-ca' } ],
  data: { title: [ [Object] ], slices: [ [Object], [Object], [Object] ] }
}

the answer is on this link
https://community.prismic.io/t/not-able-to-query-slice-machine-slices-with-graphquery/7030/23
the documentation should definitely be updated
thank you

Hello @loudmu

I am glad that you found an answer. Indeed, the documentation needs to be updated. It's already on our list. We will update this soon.

Thanks,
Priyanka