Cannot use graphql API metafieldSet for onlineStorePage and onlineStoreArticle

I try to use metafieldSet mutation but it doesn’t work for onlineStorePage and onlineStoreArticle:

mutation metafieldsSet($metafields: [MetafieldsSetInput!]!) {
  metafieldsSet(metafields: $metafields) {
    metafields {
      # Metafield fields
    }
    userErrors {
      field
      message
    }
  }
}
{
        "metafields": {
            "key": "test1",
            "namespace": "global",
            "ownerId": "gid://shopify/OnlineStorePage/6602811342925",
            "type": "single_line_text_field",
            "value": "123"
        }
    }

Return errors:

[{‘message’: ‘invalid id’, ‘locations’: [{‘line’: 2, ‘column’: 5}], ‘path’: [‘metafieldsSet’]}]

When I try to change the ownerId to

I try to use metafieldSet but it doesn’t work for onlineStorePage and onlineStoreArticle

When I try to change the ownerId to “gid://shopify/Product/1234”, it works again. Why doesn’t it support these 2 resources?

It looks like metafieldsSet does not work for the following 3 ID formats. Is it a bug? Or should the format of these ID’s be different?

gid://shopify/OnlineStoreBlog/xxx
gid://shopify/OnlineStoreArticle/xxx
gid://shopify/OnlineStorePage/xxx

Thanks

Try with newer api versions, I’d the same issues with company gid and using 2023-01 api version I make my day!

OnlineStorePage still not working with 2023-04, error response persists.

Used the REST API instead.

It works now (but you still can’t mutate actual articles)

source: https://shopify.dev/changelog/graphql-admin-api-support-for-metafield-connections-in-online-store-objects

Effective April 29, 2024

As of version 2024-07 of the GraphQL Admin API, you can use the Metafield and MetafieldDefinition connections in the OnlineStoreArticle, OnlineStoreBlog, and OnlineStorePage objects.

Previously, you could only do this using the REST API.