Cant add records to DatoCMS client side from a 404 page

Trying to make a 404 error logs but getting errors

---
import MainLayout from "../layouts/MainLayout.astro";
import getPage from "request:getPage";
const page = await getPage('/404');
---

<MainLayout seo={page.seo} >
    <div class="a-container-regular-2" style="padding-top: 200px">
        <center>
            <h1>404 page</h1>
            <p>Page not found</p>
        </center>
    </div>
    <script is:inline >
        const newItem = {
          errorType: '404',
          errorDescription: 'Page not found',
          url: window.location.href
        };
  
        const query = `
          mutation CreateErrorLog($data: ErrorLogCreateInput!) {
            createErrorLog(data: $data) {
              id
            }
          }
        `;
  
        const variables = {
          data: newItem
        };
  
        fetch('https://graphql.datocms.com/', {
          method: 'POST',
          headers: {
            'Content-Type': 'application/json',
            'Authorization': `Bearer API-TOKEN-FULL-ACCESS-TO-ERROR_LOG-MODEL`
          },
          body: JSON.stringify({
            query,
            variables
          })
        }).then(response => response.json())
          .then(data => console.log(data))
          .catch(error => console.error(error));
      </script>
</MainLayout>

Here is the query

query MyQuery {
  errorLog {
    _createdAt
    errorDescription
    errorType
    url
  }
}

We keep getting this error

[
    {
        "message": "Schema is not configured for mutations",
        "locations": [
            {
                "line": 2,
                "column": 11
            }
        ],
        "path": [
            "mutation CreateErrorLog"
        ],
        "extensions": {
            "code": "missingMutationConfiguration"
        }
    },
    {
        "message": "Variable $data is declared by CreateErrorLog but not used",
        "locations": [
            {
                "line": 2,
                "column": 11
            }
        ],
        "path": [
            "mutation CreateErrorLog"
        ],
        "extensions": {
            "code": "variableNotUsed",
            "variableName": "data"
        }
    }
]

(Moderator note: Fixed code formatting)

Are you trying to write an error to your model in DatoCMS? Unfortunately, we don’t support GraphQL writes (mutations)… as far as I know, it’s not a common feature among our CMS competitors :frowning: (There’s at least one or two who do, but most don’t, I think)

Instead, I’m afraid you to have use our separate Content Management API (a REST API, either over HTTP or with our JS client). For example, to create a new record with our JS client:

import { buildClient } from "@datocms/cma-client-node";
async function run() {
  const client = buildClient({ apiToken: "<YOUR_API_TOKEN>" });
  const record = await client.items.create({
    item_type: { type: "item_type", id: "1234" },
    name: "Buddy",
    breed: "Labrador",
    description: "Very friendly and calm.\nI love it.",
    age: 4,
  });
  console.log(record);
}
run();

Ok thanks…let me try that.