We’re trying to create app-owned metaobjects to be able to store and query some customer data, however when we run metaobjectUpsert
or metaobjectCreate
to create a metaobject with a type starting with “$app:”, we get the following error (tried both from GraphiQL and from a local script):
Not authorized to modify entries of type “app–174649278465–membership_expiration”
Here is the metaobject definition that we create using the same app that we use to try to create the metaobjects.
[
{
type: '$app:membership_expiration',
displayNameKey: 'customer_id',
name: 'Membership Expiration',
description: 'Tracks membership expiration dates for customers without payment methods',
access: { admin: 'MERCHANT_READ', storefront: 'NONE' },
fieldDefinitions: [
{
key: 'customer_id',
name: 'Customer ID',
description: 'The ID of the customer',
type: 'single_line_text_field',
required: true,
},
{
key: 'expiration_date',
name: 'Expiration Date',
description: 'The date when the membership expires (YYYY-MM-DD)',
type: 'single_line_text_field',
required: true,
},
],
},
]
Creating the definition works as expected without any errors. When we query the createdByApp { id }
field from the metaobject definition and currentAppInstallation { app { id } }
they both return the same app prefix. We have added read_metaobjects
and write_metaobject_definitions
to the scopes.
What would be the next steps to debug this issue? How do I know what is causing my app not being authorized to access its own metaobjects?
Thanks for your help.