Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image Sharp not working #3

Closed
steoneill opened this issue Jul 6, 2020 · 4 comments
Closed

Image Sharp not working #3

steoneill opened this issue Jul 6, 2020 · 4 comments

Comments

@steoneill
Copy link

When querying an imageSharp field, i get this back:

Unexpected error value: "failed to process https://images.prismic.io/rmslocotec/ac94c66f-6ef2-4aa0-a3d7-d9fac5d2751f_rmslogo(3).jpg\nError: ENOENT: no such file or directory, open '/Users/ste/code/gatsby/rms/.cache/caches/@prismicio/gatsby-source-prismic-graphql/tmp-35ff2d2f997a518e1750797ef4bb48d7.jpg'"

   5 |   srcSet
   6 |   sizes
   7 | }
   8 |
   9 | query Logo {
  10 |   prismic {
  11 |     allSite_settingss {
  12 |       edges {
  13 |         node {
  14 |           logo
> 15 |           logoSharp {
     |           ^
  16 |             childImageSharp {
  17 |               fluid(maxWidth: 400, maxHeight: 250) {
  18 |                 ...GatsbyImageSharpFluid
  19 |               }
  20 |             }
  21 |           }
  22 |         }
  23 |       }
  24 |     }
  25 |   }

@MarcMcIntosh
Copy link

Yes, my understanding of this issue is that sharp/gatsby-image require the image to be on disk to do transformations.
While images in prismic are handled through imgix, it should be able to pass those parameters to imgix but then sharp wouldn't be doing the transformations.

I think there was a similar issue with contentful.
https://www.gatsbyjs.org/packages/gatsby-transformer-sharp/#how-to-use

Note: An exception to this is when using gatsby-source-contentful, as the source plugin and the assets are not downloaded to the local filesystem. By default, the gatsby-source-contentful plugin creates a ContentfulAsset node for every image with links to Contentful’s CDN, therefore it is not necessary to use gatsby-transformer-sharp together with gatsby-source-contentful.

@TimFletcher
Copy link

I was able to tweak the fix from here.

gatsby-node.js

var fs = require("fs")
var dir = "./.cache/caches/@prismicio/gatsby-source-prismic-graphql"

exports.onPreBootstrap = () => {
  if (!fs.existsSync(dir)) {
    fs.mkdirSync(dir, { recursive: true })
  }
}

@MarcMcIntosh
Copy link

@TimFletcher interesting :)
does it download the file?

MarcMcIntosh added a commit that referenced this issue Jul 9, 2020
@MarcMcIntosh MarcMcIntosh mentioned this issue Jul 9, 2020
MarcMcIntosh added a commit that referenced this issue Jul 9, 2020
@MarcMcIntosh
Copy link

@steoneill should be fixed now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants