Setting up an XM+EDGE instance in the Sitecore Demo Portal, I encountered a couple of gotchas with querying data via the Experience Edge GraphQL IDE. If you are already familiar with the Portal but are getting the error:
The field 'item' does not exist on the type 'query'
then skip down a couple of paragraphs to the solution.
tl;dr
- Create a publishing target with database “experienceedge“
- Check the Publish to Experience Edge checkbox and save the new target
- Publish the site to your new Edge publishing target and wait a few seconds before querying it, while the schema gets generated
- PROFIT
The Demo Portal
The Sitecore Demo Portal was created to provide the ability to easily spin up demo sites that you can play with, learn, and showcase. You can very quickly create a complete headless site or commerce instance, as well as an empty XM + Experience Edge instance:

It’s available to Sitecore partners, MVPs, and Sitecore employees, and has been covered a few months back by Jeremy Davis and others, so I won’t go into any detail here, but you can learn more from Jeremy’s blog post or Neil Killen’s blog post.
I was looking to learn more about Experience Edge (and in particular use GraphQL on Edge) as I haven’t had the opportunity to work on a new Edge site for a customer, so I logged in and set up an XM+EDGE demo instance. This deployed surprisingly fast – in a matter of seconds – the team have really supercharged the deployment process since I last tried it a while back.

NOTE: This is NOT XM Cloud, it is a demo instance of XM that uses Experience Edge.
The problem
Once I navigated to the Experience Edge URL at https://edge.sitecorecloud.io/api/graphql/ide and configured the HTTP header for my API key, I tried to run a simple query to retrieve the default Home item:
query{
item(path:"/sitecore/content/home", language:"en"){
id
}
}
The result was the following error:
{
"errors": [
{
"message": "The field `item` does not exist on the type `query`.",
"locations": [
{
"line": 2,
"column": 3
}
]
}
]
}
The solution
The cause of the error was that I had not yet published my site to Edge, so the schema was not available to query. To fix this, do the following:
Create a new publishing target with Target Database “experienceedge” and check the Publish to Experience Edge checkbox:

Publish your site to that publishing target

Wait until it finishes, refresh your IDE GraphQL IDE window, and wait a few seconds for the schema to be generated, then run your query
