Need some assistance with creating app-data metafields. I am following the guide, but when I attempt to store data with metafieldsSet , I get an INTERNAL_ERROR code and message Unexpected system error. Try again later.
In troubleshooting this issue on my own, I discovered that if I manually specify a namespace, then the metafieldsSet mutation works without any errors. I discovered this as the example in the guide shows a namespace as part of the mutation input variables.
However, looking at the documentation for metafieldsSet, the MetafieldsSetInput object shows a namespace field with the following comment:
The container for a group of metafields that the metafield is or will be associated with. Used in tandem with key to lookup a metafield on a resource, preventing conflicts with other metafields with the same key. If omitted the app-reserved namespace will be used.
For this reason, I omitted the namespace as part of input, but unfortunately this is what seems to have caused the INTERNAL_ERROR. I would prefer the namespace be the app-reserved namespace as opposed to manually specifying a namespace in the metafieldsSet mutation.
Please confirm if this is a documentation error or a bug with the metafieldsSet mutation.
…As an aside, I replied to the support ticket with the same findings, yet never received a reply. What is the point of having an API support channel if there is no timely response? Is this forum the preferred support channel for GraphQL/API related issues?
ownerId is the shopify gid of the resource, not the app ID (the example in the docs is "gid://shopify/Product/20995642"), you don’t need to pass your app ID as we know this already whenever you make a request
If you look at the the example in Step of the guide, you will see the appInstallationId is used for the ownerId, as this is an app-data metafield, not a “standard” metafield (product, variant, order, etc…) The example also specifies a namespace, where I was omitting the namespace in order to use the app-reserved namespace.
I just ran the metafieldsSet mutation again, omitting the namespace, and received the same INTERNAL_ERROR with message "Unexpected system error. Try again later."
The X-Request-Id for this request is 8df2fa81-3f82-4516-8e83-d2c8d112151d-1737388994, timestamp Mon, 20 Jan 2025 16: 03: 14 GMT
Our team recently pushed an update allowing app data metafields to use their default app-reserved namespace, which should fix the internal error you were encountering. Let me know if you’re still seeing this issue.
@Liam-Shopify Thanks for the update. I just did another test and unfortunately the same error persists. The new Request ID is a5066846-d89b-4c47-a1d6-bca725c489e2-1738689952
Please follow up with the custom data team. Please provide regular updates.
I heard back from support today that the issue was resolved. I tested earlier this afternoon and I was able to create the app-data metafield with the app-reserved namespace as per the documentation I referenced in this thread.
It took a little while, but we eventually got to a resolution.
This isn’t true and big mess up passing through many hands unless there’s some massive omission in the docs about how to force metafieldSet to come with hidden context on our side of things that overrides what the graphql validation allows to assume what the owner resource is.
Quickly provable by just using the query straight out of the docs with ownerId param removed from the variables in graphiql.
Docs: Use app-data metafields and remove ownerId param from varibles
Will get this type of error response from shopify
{
"errors": [
{
"message": "Variable $metafieldsSetInput of type [MetafieldsSetInput!]! was provided invalid value for 0.ownerId (Expected value to not be null)",
"locations": [
{
"line": 1,
"column": 33
}
],
"extensions": {
"value": [
{
"namespace": "secret_keys",
"key": "api_key",
"type": "single_line_text_field",
"value": "aS1hbS1hLXNlY3JldC1hcGkta2V5Cg=="
}
],
"problems": [
{
"path": [
0,
"ownerId"
],
"explanation": "Expected value to not be null"
}
]
}
}
]
}