birkir / gatsby-source-prismic-graphql

Gatsby source plugin for Prismic GraphQL
MIT License
137 stars 75 forks source link

Sharp transformed image returns null if original image is not queried #108

Open xndyz opened 4 years ago

xndyz commented 4 years ago

If you don't query for the original image, the sharp transformation returns null.

Working query:

query ProductsQuery {
  prismic {
    allProducts_pages {
      edges {
        node {
          _linkType
          header_imageSharp {
            childImageSharp {
              fluid {
                base64
                tracedSVG
                aspectRatio
                src
                srcSet
                srcWebp
                srcSetWebp
                sizes
                originalImg
                originalName
                presentationWidth
                presentationHeight
              }
            }
          }
          header_image
        }
      }
    }
  }
}

Not working:

query ProductsQuery {
  prismic {
    allProducts_pages {
      edges {
        node {
          _linkType
          header_imageSharp {
            childImageSharp {
              fluid {
                base64
                tracedSVG
                aspectRatio
                src
                srcSet
                srcWebp
                srcSetWebp
                sizes
                originalImg
                originalName
                presentationWidth
                presentationHeight
              }
            }
          }
        }
      }
    }
  }
}
michaeljblum commented 4 years ago

I'm experiencing the same thing.

I recall being able to query just the imageSharp without having to also query the standard image in the past, though, with this same plugin in a previous project only a couple of months ago. What's changed?

lqze commented 4 years ago

@fandy Experiencing the same issue here. I'm experiencing it only singleton type queries as well as repeatable types.

lqze commented 4 years ago

https://www.gatsbyjs.org/packages/gatsby-source-prismic-graphql/#working-with-gatsby-image

This is actually documented above. I'd suggest closing this issue or having this maybe documented a little more?