Reputation: 65
I'm using nextjs and (new to graphql) trying fetch data from wordpress with graphql endpoint
I followed this repo
https://github.com/alexander-young/wp-next-headless
with this tutorial
https://www.youtube.com/watch?v=bIc6NrPsHjs
but getting this err
FetchError: invalid json response body at http://www.ahmedsamir.rf.gd/graphql reason: Unexpected token < in JSON at position 0
the part about the query works fine, any idea?
Upvotes: 2
Views: 3392
Reputation: 781
Give it a try to hit on the valid route so that you get the JSON response.
curl --request POST \
--header 'content-type: application/json' \
--url 'http://www.ahmedsamir.rf.gd/graphql' \
--data '{"query":"query { __typename }"}'
the response you're getting HTML. that's how you get the err.
<html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx</center>
</body>
</html>
Upvotes: 2