GraphQL mutation metaobjectUpdate error 400

Topic summary

A developer is encountering a 400 Bad Request error when attempting to update a metaobject (specifically product ratings) using Shopify’s GraphQL metaobjectUpdate mutation via the shopify-api-node library.

What’s working:

  • Successfully retrieving metaobject data, including the metaobject ID

What’s failing:

  • The mutation to update metaobject fields (rating and count) returns HTTP 400 error with code ‘ERR_NON_2XX_3XX_RESPONSE’

Technical details:

  • Using mutation with variables for ID (gid://shopify/Metaobject/2085388555) and fields (rating: 4.1, count: 700)
  • The error occurs during the GraphQL request execution
  • Timing metrics show the request completes quickly (total: 174ms) but fails at the response phase

Current status: The issue remains unresolved. The developer is seeking help identifying what’s wrong with their mutation implementation, as the error response doesn’t provide clear guidance on the root cause.

Summarized with AI on November 19. AI used: claude-sonnet-4-5-20250929.

Hi, we’re trying to update a metaobject including ratings for our store via the GraphQL API. We’re using the shopify-api-node by monei to do this. Receiving data such as the metaobject’s id was successful, but we can’t seem to update the metaobject’s data.

This is our code:

  const query = `mutation metaobjectUpdate($id: ID!, $metaobject: MetaobjectUpdateInput!) {
    metaobjectUpdate(id: $id, metaobject: $metaobject) {
      metaobject {
        rating
        count
      }
      userErrors {
        field
        message
        code
      }
    }
  }`;

  const variables = `{
    "id": "gid://shopify/Metaobject/2085388555",
    "metaobject": {
      "fields": [
        {
          "key": "rating",
          "value": 4.1
        },
        {
          "key": "count",
          "value": 700
        }
      ]
    }
  }`;

  const test = `{
    metaobjects(type: "reviews", first: 3) {
      edges {
        node {
          id
          handle
        }
      }
    }
  }`;

  return await shopify.graphql(query, variables);

And this is the response:

HTTPError: Response code 400 (Bad Request)
    at Request.<anonymous> (/Users/<hidden-stuff>/node_modules/got/dist/source/as-promise/index.js:118:42)
    at processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'ERR_NON_2XX_3XX_RESPONSE',
  timings: {
    start: 1687252703717,
    socket: 1687252703718,
    lookup: 1687252703721,
    connect: 1687252703750,
    secureConnect: 1687252703788,
    upload: 1687252703788,
    response: 1687252703891,
    end: 1687252703891,
    error: undefined,
    abort: undefined,
    phases: {
      wait: 1,
      dns: 3,
      tcp: 29,
      tls: 38,
      request: 0,
      firstByte: 103,
      download: 0,
      total: 174
    }
  }
}

As you can see it’s pretty useless. Does anyone see what we’re doing wrong?