"Internal error" when querying MediaImage node on the Storefront API

Solved

"Internal error" when querying MediaImage node on the Storefront API

div_eloper
Shopify Partner
3 1 2

Storefront API Version: 2021-10.

What I'm trying to do: Query `MediaImage` data associated with a product metafield.

After :

  1. Creating a product metafield with Shopify's new metafields interface
  2. Using the Admin API to expose the metafield to the Storefront API
  3. 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?

Accepted Solution (1)

div_eloper
Shopify Partner
3 1 2

This is an accepted solution.

The Storefront API bug has been fixed. I'm now able to query for `MediaImage` nodes:

shopify-storefront-api-query-node-media-image.png

 

Thanks for fixing this bug!

View solution in original post

Replies 3 (3)

swalkinshaw
Shopify Staff
20 4 12

This is a bug on Shopify's side as you suspected. I've created an issue internally and it should hopefully be fixed soon.

Thank you for the very detailed post.

To learn more visit the Shopify Help Center or the Community Blog.

div_eloper
Shopify Partner
3 1 2

Thank you so much for the response and for creating the bug ticket, @swalkinshaw!

div_eloper
Shopify Partner
3 1 2

This is an accepted solution.

The Storefront API bug has been fixed. I'm now able to query for `MediaImage` nodes:

shopify-storefront-api-query-node-media-image.png

 

Thanks for fixing this bug!