A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hello,
I am experiencing an API request error while trying to create an app-owned metafield. Here is the error message I get from the graphQL request:
{ "errors"=> [ { "message"=>"Internal error. Looks like something went wrong on our end.\nRequest ID: 72c91ab7-6ecb-4e89-8bc3-78088121de2f (include this in support requests).", "extensions"=> { "code"=>"INTERNAL_SERVER_ERROR", "requestId"=>"72c91ab7-6ecb-4e89-8bc3-78088121de2f" } } ] }
Here is the GraphQL request :
mutation CreateAppDataMetafield($metafieldsSetInput: [MetafieldsSetInput!]!) {
metafieldsSet(metafields: $metafieldsSetInput) {
metafields {
id
namespace
key
}
userErrors {
field
message
}
}
}
Solved! Go to the solution
This is an accepted solution.
Hey @Fabien_Sebban,
Our team was able to take a closer look at the error using the request id, and located logs on our end. Upon closer inspection, we noticed that you are passing data intended for multiple kinds of metafields, both with a different purpose.
App data metafields (more info here), allow an app to store data related to features, client info, or an app payment plan in the metafields, to be queried or used in conditional app blocks. These don't support a reserved namespace formatting with a prefix, $app:
- as seen in the input you shared eg "$app:some-namespace"
. This formatting is intended for object or resource based metafields that are owned by an app, leveraged through an API layer, and used to set access control. We have a another doc with more info here; this includes examples, an overview of how this can be used, and how the namespace formatting resolves.
With regards to the internal server error you encountered, I connected with our developers and shared this specific example with them. Furthermore, I advocated on you behalf regarding any confusion, and the developers will be looking into more informative error messages that are relevant for situations like this.
Hope this helps provide clarity and a few resources to work towards your end goal!
Cheers! - @awwdam
Shopify Developer Support
Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
Hi @Fabien_Sebban 👋
I'd recommend checking your `appInstallation.id` with the `currentAppInstallation` query below:
{
currentAppInstallation { id }
}
The logs indicate that the `ownerId` input is invalid, and I'll let the product team know that it would be valuable to add an error message rather than the 500 error. Keep in mind that app-data metafield can only be created/accessed by the same app itself, we have an overview on app-data metafields here as well.
Hope that helps!
Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
Thanks for the reply @Umiko.
I made sure I provided the correct currentAppInstallation ID and it seems I did it correctly.
Here you have another requestID that presents the same error: 2241ce1f-d415-446b-8e7a-b490cdb0e0cf
The provided AppInstallation ID is: gid://shopify/AppInstallation/402935021757
This is the one I get from the graphQL request.
This is an accepted solution.
Hey @Fabien_Sebban,
Our team was able to take a closer look at the error using the request id, and located logs on our end. Upon closer inspection, we noticed that you are passing data intended for multiple kinds of metafields, both with a different purpose.
App data metafields (more info here), allow an app to store data related to features, client info, or an app payment plan in the metafields, to be queried or used in conditional app blocks. These don't support a reserved namespace formatting with a prefix, $app:
- as seen in the input you shared eg "$app:some-namespace"
. This formatting is intended for object or resource based metafields that are owned by an app, leveraged through an API layer, and used to set access control. We have a another doc with more info here; this includes examples, an overview of how this can be used, and how the namespace formatting resolves.
With regards to the internal server error you encountered, I connected with our developers and shared this specific example with them. Furthermore, I advocated on you behalf regarding any confusion, and the developers will be looking into more informative error messages that are relevant for situations like this.
Hope this helps provide clarity and a few resources to work towards your end goal!
Cheers! - @awwdam
Shopify Developer Support
Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog