I am using Sitecore 10.3 SXA Headless and using NextJS Page Router for my Front-end. Basically, I want to create an item by using graphQL mutation method. I have followed this stackexchange issue and also added this below shown configuration as mentioned in the answer,
<configuration>
<sitecore>
<pipelines>
<owin.cookieAuthentication.validateIdentity>
<processor type="Sitecore.Owin.Authentication.Pipelines.CookieAuthentication.ValidateIdentity.ValidateSiteNeutralPaths, Sitecore.Owin.Authentication">
<siteNeutralPaths hint="list">
<path hint="graphql">/sitecore/api/graph/items/</path>
</siteNeutralPaths>
</processor>
</owin.cookieAuthentication.validateIdentity>
</pipelines>
</sitecore>
</configuration>
I have created templates and fields as required and added the GraphQL query as mentioned,
mutation CreateItem {
createItem(
name: "ExampleItem"
template: "{1706CEB1-318A-4D71-A1B8-6FCCEA238762}"
parent: "{27ACB186-4F20-44E8-BD94-8C1C73F97529}"
language: "en"
fields: [
{ name: "Title", value: "'Example Item'" }
{ name: "Text", value: "'This is an example item created with GraphQL'" }
]
) {
path
}
}
but still I am facing some issue in the GraphQL Edge Playground, which says...
{
"errors": [
{
"message": "GraphQL.ExecutionError: Schema is not configured for mutations ---> GraphQL.ExecutionError: Schema is not configured for mutations\r\n at GraphQL.Execution.ExecutionHelper.GetOperationRootType(Document document, ISchema schema, Operation operation)\r\n at GraphQL.Execution.ExecutionStrategy.<ExecuteAsync>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at GraphQL.DocumentExecuter.<ExecuteAsync>d__8.MoveNext()\r\n --- End of inner exception stack trace ---",
"extensions": {
"code": "EXECUTION_ERROR"
}
}
]
}
Btw, I am a newbie in Sitecore and JSS, thanks 🙂