Recently, while doing another setup, I got this error
Solution - First try to hit this URL
It's related with the Jss API, make sure that you have created a new API key here
Try to this this URL to confirm if the GraphQL service is running
When I hit this URL, I got below error
Follow this document to setup the GraphQL - https://doc.sitecore.com/xp/en/developers/hd/21/sitecore-headless-development/start-using-sitecore-graphql-api.html
Here are the steps
1. Update this configuration to true
<compilation debug="true">.
Enable the master GraphQL file
After this change, I got a different error while browing GraphQL service
https://sitecore103sc.dev.local/sitecore/api/graph/items/master/ui
I go this error
Make below change to Sitecore.Services.GraphQL.config
Go to
C:\inetpub\wwwroot\Sitecore103sc.dev.local\App_Config\Sitecore\Owin.Authentication\Sitecore.Owin.Authentication.config
add this line
<path>/sitecore/api/graph/items</path> under </siteNeutralPaths>
After that change, I can browser the GraphQL through the UI
Please note, it's recommned that you should not enable these GraphQL end point on prodution for the security purpose, all these changes I'm doing is just for the local setup.
but still, I got the authentication error , I'm running below query
query {
# path can be an item tree path or GUID-based id
item(path: "/sitecore/content/Experience-Edge/home", language: "en") {
# items can be cast to a Template type with inline fragments
... on AppRoute {
pageTitle {
value
}
}
# fields can be cast to a Field type with inline fragments
field(name: "pageTitle") {
... on TextField {
value
}
}
}
}
I made the below changes to the API key, related to the CORS but it didn't help
rror: GraphQL.ExecutionError: Error trying to resolve layout. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: root
at Sitecore.Diagnostics.Assert.ArgumentNotNull(Object argument, String argumentName)
at Sitecore.Data.ItemResolvers.ItemPathResolver.ResolveItem(String path, Item root)
at Sitecore.Services.GraphQL.EdgeSchema.Queries.LayoutQuery.Resolve(ResolveFieldContext context)
at Sitecore.Services.GraphQL.Schemas.RootFieldType`2.Intercept(ResolveFieldContext context)
at GraphQL.Resolvers.FuncFieldResolver`1.GraphQL.Resolvers.IFieldResolver.Resolve(ResolveFieldContext context)
at GraphQL.Execution.ExecutionStrategy.<ExecuteNodeAsync>d__7.MoveNext()
--- End of inner exception stack trace ---: {"response":{"data":{"layout":null},"errors":[{"message":"GraphQL.ExecutionError: Error trying to resolve layout. ---> System.ArgumentNullException: Value cannot be null.\r\nParameter name: root\r\n at Sitecore.Diagnostics.Assert.ArgumentNotNull(Object argument, String argumentName)\r\n at Sitecore.Data.ItemResolvers.ItemPathResolver.ResolveItem(String path, Item root)\r\n at Sitecore.Services.GraphQL.EdgeSchema.Queries.LayoutQuery.Resolve(ResolveFieldContext context)\r\n at Sitecore.Services.GraphQL.Schemas.RootFieldType`2.Intercept(ResolveFieldContext context)\r\n at GraphQL.Resolvers.FuncFieldResolver`1.GraphQL.Resolvers.IFieldResolver.Resolve(ResolveFieldContext context)\r\n at GraphQL.Execution.ExecutionStrategy.<ExecuteNodeAsync>d__7.MoveNext()\r\n --- End of inner exception stack trace ---","locations":[{"line":2,"column":7}],"path":["layout"],"extensions":{"code":"ARGUMENT_NULL"}}],"status":200,"headers":{}},"request":{"query":"query {\n layout(site:\"sitecore-jss-app\", routePath:\"/\", language:\"en\"){\n item {\n rendered\n }\n }\n }"}}
\
No comments:
Post a Comment