Storefront API Version: 2021-10.
What I’m trying to do: Query MediaImage data associated with a product metafield.
After :
- Creating a product metafield with Shopify’s new metafields interface
- Using the Admin API to expose the metafield to the Storefront API
- Uploading an image as the metafield’s value for a particular product
I use the following query to request the image data contained in the metafield:
query {
product(handle: "high-roller-skates") {
handle
metafields(first: 5) {
edges {
node {
namespace
key
value
}
}
}
}
}
which returns:
{
"data": {
"product": {
"handle": "high-roller-skates",
"metafields": {
"edges": [
{
"node": {
"namespace": "my_fields",
"key": "bearings",
"value": "gid:\/\/shopify\/MediaImage\/20867885990023"
}
}
]
}
}
}
}
Using the Shopify Global ID given in the metafield’s value, I run a second query for the actual image data:
{
node(id: "gid://shopify/MediaImage/20867885990023") {
... on MediaImage {
id
image {
altText
originalSrc
}
mediaContentType
}
}
}
Unfortunately, this results in an INTERNAL_SERVER_ERROR:
{
"errors": [
{
"message": "Internal error. Looks like something went wrong on our end.\nRequest ID: fc94c2e8-9b59-4d8e-9eb3-2eb2a6e49f78 (include this in support requests).",
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"requestId": "fc94c2e8-9b59-4d8e-9eb3-2eb2a6e49f78"
}
}
]
}
I’ve tried using the base-64 encoded version of the global ID (“Z2lkOi8vc2hvcGlmeS9NZWRpYUltYWdlLzIwODY3ODg1OTkwMDIz”), but this results in the same INTERNAL_SERVER_ERROR.
Is this a bug in the Storefront API, or is there another issue at play?
