wp-graphiql
wp-graphiql copied to clipboard
No Schema Available? SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
I've installed the wp-graphql and wp-graphiql API, but I can't seem to make any queries within the graphiql interface. I receive the error "SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data" when I make any queries or interactions. When I click "Explorer" I see "No Schema Available" - Any assistance would be greatly appreciated!
@mckhames what version of WPGraphQL are you on? As of v0.13.0 GraphiQL is now built-in to WPGraphQL and this plugin is no longer needed.
In any case, this usually means there's a PHP error that's preventing WordPress from being able to complete the GraphQL request.
I would recommend checking your php error logs on your server to see if you can find anything there.
Another thing you can try is opening Chrome DevTools when you're on the GraphiQL page and inspecting the "network" tab. The "response" tab will often show issues.
For example, I put the following code in a plugin:
add_action( 'init_graphql_request', function() {
var_dump( 'test' );
die();
} );
This code prevents WPGraphQL from properly executing, and thus GraphiQL won't get JSON in response and won't know what to show the user.
If I open the "Network" tab of Chrome Dev Tools, execute a GraphQL Query, then check the "Response" for that request, I can see the response that's preventing GraphiQL from getting a proper JSON response.

Thank you so much for this very detailed and helpful debugging guide. Looking at the response I receive, the payload is my entire front page, it seems. I can't quite understand why 0_0.
P.S. I did realize that I do not need GraphiQL and removed it, and have since updated to the latest GraphQL (thank y'all for integrating them!)
