I have a metafield definition that is owned by SHOP, and it has a reserved namespace.
If I access it like so, I can, no problem.
HOWEVER, when I try to access the same exact metafield definition just in a different way, I get hit with this:
This weird bug is also causing my product discount function to fail, since accessing the shop metafield using key and namespace now returns null. However, on the flip side, I can access the metafield using liquid on the frontend quite easily.
It seems like this issue popped up of nowhere, since everything was working fine a while ago, and the production version of this app is also working fine.
Hey @Hadimalikdev
Which API version are you using for your requests? The reason I ask is the identifier input is currently only available on the latest API version 2025-04. If you’re using 2025-01 and older, that may explain the error. metafieldDefinition - GraphQL Admin
If that doesn’t resolve this, I see you’re using a Graphiql app. Are you using the Graphiql app installed on the store, or are you using the CLI development Graphiql client? The reason I ask is there may be some permission issues occurring when you use the app identifier if you are requesting this through an app that doesn’t have the permissions to access the specified namespace or resource.
Let me know what you find after looking at the above.
Hey Kyle!
Thanks for responding. Yeah, the issue for the first problem turned out to be me using the GraphiQL app on the store instead of the one provided by the CLI development app. However, that still leaves the second problem unresolved.
I can access the metafield value in my app block widget as shown:

However, when I try to access the same from my product discount function, it returns null
query RunInput {
cart {
lines {
attribute(key:"__magic_upsell_offer_id") {
key
value
}
id
quantity
}
}
shop {
metafield(namespace: "$app:magic-upsell", key: "offers") {
jsonValue
}
}
}
Also attaching the access permissions for this metafield definition.
My function’s API version is 2024-10
Figured it out, json value exceeded 10kb, hence was returning null. Thank you, Kyle!
1 Like