I'm having trouble using request that works in the GraphQL Explorer to my Node.js code.
Here is my request successfully fetching data in my project :
{
allMechanicss {
edges {
node {
title
}
}
}
_allDocuments {
edges {
node {
__typename
}
}
}
}
When I want to feed my GraphQL client, I'm getting this error : ApolloError: Network error: Unexpected token < in JSON at position 0
I'll use a variable to hold the request like this :
let allTown = gql`
{
allMechanicss {
edges {
node {
title
}
}
}
}
`;
Thanks for contributing to the Prismic community,
In order to help you troubleshoot the issue, I would need to have a look you are running.
Sharing a code snippet of the code that calls apolloGraphQl would be useful as well as the name of the repository that you are call (in a private message if necessary).
Apart from the fact that I added "api" by the end of the url, what really confounded me was the "cdn" keyword. The Prismic GraphQL doc at paragraph 3.1 says :
We have been in a contact with our devOps team and they said that the endpoint with the .cdn should work. The issue that you had was simply because you have added /api to the url.
so the endpoint mentioned in the GraphQL docs should remain as it is recommended to use the CDN: https://your-repository-name.cdn.prismic.io/graphql