Media returning image: null

Solved

Media returning image: null

ShaneOH
Shopify Partner
21 1 8

I have a customer that is having issues with their images and don't know why

I'm using this mutation:

mutation($input: ProductInput!, $variantCount: Int!, $mediaCount: Int!, $media: [CreateMediaInput!]) {
  productCreate(input: $input, media: $media) {
    product {
      id
      publishedAt
      handle
      variants(first: $variantCount) {
        edges {
          node {
            id
            sku
            createdAt
            updatedAt
            inventoryItem {
              id
            }
          }
        }
      }
      images(first: $mediaCount) {
        edges {
          node {
            id
            url
          }
        }
      }
      media(first: $mediaCount) {
        edges {
          node {
            id
            ... on MediaImage {
              id
              image {
                id
                url
              }
              mediaContentType
            }
          }
        }
      }
    }
    userErrors {
      field
      message
    }
  }
}

 

 

with following params:

{
  "descriptionHtml": "<b>We're on Instagram! Follow us! oe_mgarage<br><br>All parts are used unless otherwise noted! Please understand that being that parts are used there may be some wear and tear & scratches etc. We cannot guarantee the condition of paint & or that paint colo... (truncated)",
  "media": {
    "media": [
      {
        "originalSource": "https://assets.mysuredone.com/688078/media-photos/27773-07-13-oem-bmw-e92-e93-m3-interior-central-console-rear-vent-oddments-tray-trim.jpg",
        "mediaContentType": "IMAGE"
      },
      {
        "originalSource": "https://assets.mysuredone.com/688078/media-photos/27773-07-13-oem-bmw-e92-e93-m3-interior-central-console-rear-vent-oddments-tray-trim-2.jpg",
        "mediaContentType": "IMAGE"
      },
      {
        "originalSource": "https://assets.mysuredone.com/688078/media-photos/27773-07-13-oem-bmw-e92-e93-m3-interior-central-console-rear-vent-oddments-tray-trim-3.jpg",
        "mediaContentType": "IMAGE"
      },
      {
        "originalSource": "https://assets.mysuredone.com/688078/media-photos/27773-07-13-oem-bmw-e92-e93-m3-interior-central-console-rear-vent-oddments-tray-trim-4.jpg",
        "mediaContentType": "IMAGE"
      },
      {
        "originalSource": "https://assets.mysuredone.com/688078/media-photos/27773-07-13-oem-bmw-e92-e93-m3-interior-central-console-rear-vent-oddments-tray-trim-5.jpg",
        "mediaContentType": "IMAGE"
      },
      {
        "originalSource": "https://assets.mysuredone.com/688078/media-photos/27773-07-13-oem-bmw-e92-e93-m3-interior-central-console-rear-vent-oddments-tray-trim-6.jpg",
        "mediaContentType": "IMAGE"
      },
      {
        "originalSource": "https://assets.mysuredone.com/688078/media-photos/27773-07-13-oem-bmw-e92-e93-m3-interior-central-console-rear-vent-oddments-tray-trim-7.jpg",
        "mediaContentType": "IMAGE"
      },
      {
        "originalSource": "https://assets.mysuredone.com/688078/media-photos/27773-07-13-oem-bmw-e92-e93-m3-interior-central-console-rear-vent-oddments-tray-trim-8.jpg",
        "mediaContentType": "IMAGE"
      },
      {
        "originalSource": "https://assets.mysuredone.com/688078/media-photos/27773-07-13-oem-bmw-e92-e93-m3-interior-central-console-rear-vent-oddments-tray-trim-9.jpg",
        "mediaContentType": "IMAGE"
      },
      {
        "originalSource": "https://assets.mysuredone.com/688078/media-photos/27773-07-13-oem-bmw-e92-e93-m3-interior-central-console-rear-vent-oddments-tray-trim-10.jpg",
        "mediaContentType": "IMAGE"
      }
    ],
    "mediaCount": 20
  },
  "tags": [
    "E92",
    "262189",
    "200558742020"
  ],
  "title": "07-13 OEM BMW E92 E93 M3 Interior Central Console Rear Vent Oddments Tray Trim",
  "variants": [
    {
      "barcode": "27773",
      "inventoryManagement": "SHOPIFY",
      "price": "54.95",
      "sku": "27773",
      "title": "07-13 OEM BMW E92 E93 M3 Interior Central Console Rear Vent Oddments Tray Trim",
      "weight": 0,
      "mediaSrc": [
        "https://assets.mysuredone.com/688078/media-photos/27773-07-13-oem-bmw-e92-e93-m3-interior-central-console-rear-vent-oddments-tray-trim.jpg"
      ]
    }
  ],
  "vendor": "E92",
  "published": true
}

and this is the response

{
  "id": "gid://shopify/Product/8340117323966",
  "publishedAt": "2024-10-01T18:09:09Z",
  "handle": "07-13-oem-bmw-e92-e93-m3-interior-central-console-rear-vent-oddments-tray-trim",
  "variants": {
    "edges": [
      {
        "node": {
          "id": "gid://shopify/ProductVariant/44608559743166",
          "sku": "27773",
          "createdAt": "2024-10-01T18:09:10Z",
          "updatedAt": "2024-10-01T18:09:10Z",
          "inventoryItem": {
            "id": "gid://shopify/InventoryItem/46701594247358"
          }
        }
      }
    ]
  },
  "images": {
    "edges": []
  },
  "media": {
    "edges": [
      {
        "node": {
          "id": "gid://shopify/MediaImage/28586522869950",
          "image": null,
          "mediaContentType": "IMAGE"
        }
      },
      {
        "node": {
          "id": "gid://shopify/MediaImage/28586522902718",
          "image": null,
          "mediaContentType": "IMAGE"
        }
      },
      {
        "node": {
          "id": "gid://shopify/MediaImage/28586522935486",
          "image": null,
          "mediaContentType": "IMAGE"
        }
      },
      {
        "node": {
          "id": "gid://shopify/MediaImage/28586522968254",
          "image": null,
          "mediaContentType": "IMAGE"
        }
      },
      {
        "node": {
          "id": "gid://shopify/MediaImage/28586523033790",
          "image": null,
          "mediaContentType": "IMAGE"
        }
      },
      {
        "node": {
          "id": "gid://shopify/MediaImage/28586523099326",
          "image": null,
          "mediaContentType": "IMAGE"
        }
      },
      {
        "node": {
          "id": "gid://shopify/MediaImage/28586523164862",
          "image": null,
          "mediaContentType": "IMAGE"
        }
      },
      {
        "node": {
          "id": "gid://shopify/MediaImage/28586523230398",
          "image": null,
          "mediaContentType": "IMAGE"
        }
      },
      {
        "node": {
          "id": "gid://shopify/MediaImage/28586523295934",
          "image": null,
          "mediaContentType": "IMAGE"
        }
      },
      {
        "node": {
          "id": "gid://shopify/MediaImage/28586523328702",
          "image": null,
          "mediaContentType": "IMAGE"
        }
      }
    ]
  }
}

Why all images has "image":null ? no error returned and the product shows no image

 

Thanks

Accepted Solution (1)

ShaneOH
Shopify Partner
21 1 8

This is an accepted solution.

After a ton of testing result that customer had this error when uploading images:

 

{
                "code": "FILE_STORAGE_LIMIT_EXCEEDED",
                "details": "Adding this file will exceed the file storage limit of 300GB for your plan. ",
                "message": "Adding this file will exceed the file storage limit for your plan."
}

 

As the image upload is async on upload calls (like productVariantsBulkUpdate or productCreate) the status was always either: PROCESSING or UPLOADED.

But it wasn't returning any error.

After few tests, when I manually requested current images I got the above error.

So if you are having this same issue than me, check old images you pushed to see the status and request any mediaError.

Hope it helps somebody

View solution in original post

Reply 1 (1)

ShaneOH
Shopify Partner
21 1 8

This is an accepted solution.

After a ton of testing result that customer had this error when uploading images:

 

{
                "code": "FILE_STORAGE_LIMIT_EXCEEDED",
                "details": "Adding this file will exceed the file storage limit of 300GB for your plan. ",
                "message": "Adding this file will exceed the file storage limit for your plan."
}

 

As the image upload is async on upload calls (like productVariantsBulkUpdate or productCreate) the status was always either: PROCESSING or UPLOADED.

But it wasn't returning any error.

After few tests, when I manually requested current images I got the above error.

So if you are having this same issue than me, check old images you pushed to see the status and request any mediaError.

Hope it helps somebody