Hi,
Today I will discuss about an issue I faced where the formatting of GraphQL query was causing problems when using the Edge endpoint of Sitecore XM Cloud, even though it worked fine on the Preview endpoint.
I have configured an API Crawler with request trigger to fetch data from Sitecore using GraphQL query. Below is the body of trigger
{"query":"query getItem($path: String)
{ item(language: \"en\", path: $path)
{ id path
children (first:1000)
{
results { ... on SomeData{ id name
} } } }}","variables":{"path":"/sitecore/content/demotenant/demo-site/Data/somedata"}}
Trigger also had the required Headers, Method and URL like below

Below is the error which I was getting.
{"errors":[{"message":"The query field must be a string or null.","locations":[{"line":1,"column":10}],"extensions":{"code":"EXEC_SYNTAX_ERROR"}}]}",
In GraphQL, whitespace and formatting generally don’t matter. However, some APIs or platforms might interpret these differently. This depends on the environment or parser being used. In this case, the Edge endpoint may be stricter about how queries are formatted or interpreted, especially if there’s extra whitespace, line breaks, or non-standard character.
Here’s a summary of what I did to resolve the issue:
Original Issue:
The query worked fine on the Preview endpoint but gave an error on the Edge endpoint, which mentioned that “EXEC_SYNTAX_ERROR.”
Debugging Approach:
I used Postman to test the query. I identified that the problem was related to syntax errors. These errors were caused by empty spaces and breaklines.

Fix:
To resolve these syntax error I removed empty spaces and breaklines in the body of request. After applying this change I got the desired result.
Hope this fix will help someone!!