Re: GraphQL: when requesting images through files "Field 'url' doesn't exist on type 'Image'&qu

GraphQL: when requesting images through files "Field 'url' doesn't exist on type 'Image'"

gentlemon
Shopify Partner
17 0 3

Hey,

I always get this error when I try to request a image, even though it is defined:


https://shopify.dev/api/admin-graphql/2022-04/objects/Image#field-image-url

"Field 'url' doesn't exist on type 'Image'"

 
Seems to be a bug to me, the image resource should always have a url.

 

{
  files(first: 5) {
    edges {
      cursor
      node {
        createdAt
        alt
        __typename
        ... on MediaImage {
          id
          alt
          image {
            id
            width
            url
            height
            __typename
          }
          __typename
        }
        fileErrors {
          code
          details
          message
          __typename
        }
      }
      __typename
    }
    pageInfo {
      hasNextPage
      hasPreviousPage
      __typename
    }
    __typename
  }
}

 

 This query will fail with the mentioned error. When I remove the url it works flawlessly.

This is basically the same query that is done in the admin interface when you open the files list. Funnily, there url works without issues.

Does someone know how to solve this and get the url for the images?
 

Replies 2 (2)

med_djelaili
Shopify Partner
5 0 0

I'm facing the same issue with shopify-api-node package, but the query works on Postman

med_djelaili
Shopify Partner
5 0 0

I was using the wrong API version, the url property was added to the Image object on version 2022/01