Conversations about creating, managing, and using metafields to store and retrieve custom data for apps and themes.
Hello,
Starting October 1st (Monday), all Shopify Apps will need to comply with this new rule to omit the `type` field if a corresponding Metafield Definition exists:
https://shopify.dev/changelog/updated-metafieldssetinput-type-to-be-nullable-for-metafieldsset-mutat...
However, when trying to create a metafield definition via the Admin GraphQL API, you'll receive an error message:
[
{
field: [ 'definition' ],
message: 'Namespace and key is already in use for a set of your metafields.',
__typename: 'MetafieldDefinitionCreateUserError'
}
]
This is problematic because this means as an app developer you cannot comply with this latest API change, because you cannot create a metafield definition on behalf of merchants.
Yes, I tried `metafieldDefinitionUpdate` instead of creating a new one, which also lead to another error that's just as confusing:
[
{
field: [ 'definition' ],
message: 'Definition not found.',
__typename: 'MetafieldDefinitionUpdateUserError'
}
]
So simultaneously, the metafield definition does not exist and the metafield does exist and can't be created.
Want to see it in action? Check out our demo store.
Solved! Go to the solution
This is an accepted solution.
Hey @dylanpierce,
Shared your post with the metafields folks and they said:
Seems like there are two parts to this question:
1. There is a new rule on October 1st that type must be omitted from the set mutation.2. Can’t create a definition over a namespace/key that already exist.
For 1. I think their interpretation may be incorrect - omitting type should be optional based on the changelog: https://shopify.dev/changelog/updated-metafieldssetinput-type-to-be-nullable-for-metafieldsset-mutat...For 2. We’re looking into enabling this behaviour but can’t provide a timeline yet.
So they should be able to continue passing in type as they currently are with no disruptions, as I understand it.
Let me know if this clears things up or you have any questions!
Scott | Developer Advocate @ Shopify
This is an accepted solution.
Hey @dylanpierce,
Shared your post with the metafields folks and they said:
Seems like there are two parts to this question:
1. There is a new rule on October 1st that type must be omitted from the set mutation.2. Can’t create a definition over a namespace/key that already exist.
For 1. I think their interpretation may be incorrect - omitting type should be optional based on the changelog: https://shopify.dev/changelog/updated-metafieldssetinput-type-to-be-nullable-for-metafieldsset-mutat...For 2. We’re looking into enabling this behaviour but can’t provide a timeline yet.
So they should be able to continue passing in type as they currently are with no disruptions, as I understand it.
Let me know if this clears things up or you have any questions!
Scott | Developer Advocate @ Shopify
Thanks @SBD_
That's very helpful. I understand now that the error message in the Shopify Partner dashboard is the fact that the deprecated API Version (`2022-10` in my case) has been detected, and the items beneath are the changes that might break.
Updating my app to use a newer API Version (`2023-01`) fixed the Last detected incident.
The way the API Health dashboard was laid out, I initially thought my `metafieldUpdate` query that was including the `type` field was the _cause_ of the Last detected incident. But in fact it was just that my API call was using a soon to be deprecated version.
And after looking through out logs I can confirm that metafield updates are working. Thanks!
Want to see it in action? Check out our demo store.
Appreciate your insights. We get error when we don't pass type but get dashboard warning when we pass it on version 2023-01. We would very much appreciate if app delisting is paused until Shopify implements solution for this.
Passing type does still work.
However, the Oct 1st deadline has passed, apps are being flagged as calling unsupported APIs, ours is threatened with delisting and new installs being be blocked. Customers have flagged the app is saying it's 'unsupported'.
Metafield Definitions can't be created (on App Installation) and updating metafields require a Definition being created.
Can this be fixed asap?
Hey @mattdenoronha
Passing type is still allowed. You simply don’t have to when there’s a corresponding definition (docs).
Could you clarify whether you mean metafield definitions cannot be created during the app installation process, or, you can't create metafield definitions on the AppInstallation owner type? If the second one - definitions are not supported for the AppInstallation.
Hey @AvocadosLab
It seems the error you're referring to is related to hitting an older api version - not your specific usage of metafieldsSet. From our logs it looks like you're hitting 2022-10. Switching to 2023-01 should resolve the warning.
Scott | Developer Advocate @ Shopify