oorestisime/gatsby-source-instagram

Input File Missing When Queried

perezfitness opened this issue · 6 comments

I understand that instagram images are being cached however the the cache folder uses an absolute path. When i build on netlify the query fails because it cant find the image and that is due to cache folders path. Is there any changes that can be made so that it is relative or i can turn off the cache option. Any help is appreciated, thanks!

ERROR SHOWN

error Failed to retrieve metadata from image /Users/Charles/Desktop/career/Client Projects/Perez Fitness/site/.cache/caches/gatsby-source-instagram/dfdfdb524d1e53a35ec7350acaf03191/58410853_169523687384295_8229251386197029619_n.jpg Input file is missing
1:18:56 PM:
1:18:56 PM: Error: Input file is missing
1:18:56 PM:
1:18:56 PM: not finished run queries - 19.521s
1:18:56 PM: not finished Generating image thumbnails - 19.493s

Hey there,

Not sure i fully grasp what you are describing. Can you show me how you query this image?
You shouldn't be getting absolute paths normally.

Sure! this is what the query looks like. I got it from the given example from this repo.

export const pageQuery = graphql`
  query IndexQuery {
    allInstaNode(limit: 4, filter: { username: { eq: "perez_fitness" }  }) {
      edges {
        node {
          id
          username
          likes
          caption
          comments
          localFile {
            childImageSharp {
              fluid(quality: 70, maxWidth: 600, maxHeight: 600) {
                ...GatsbyImageSharpFluid_withWebp
              }
            }
          }
        }
      }
    }
  }
`

Hm this should work , the plugin isn't doing anything manual with the cache. it uses gatsby helpers.
what i am suspecting is maybe an incorrect downloand or a corrupted cache folder? can you reliably reproduce this somehow?

The error shows every time i deploy on netlify, but I can reproduce the error on my local machine if i delete the cache images inside the cache folder. In case the cache folder is corrupted I'm going to try following this Debugging Cache Issues Guide

This might be a dumb question but does it make a difference if the cache folder is in .gitignore? I found this guide on Gatsby Project Structure and it suggests that the cache folder should be in .gitignore. My cache folder is not in .gitignore, im going to try adding it to .gitignore and see it what happens

Im going to follow both guides and get back to you

I followed the debugging cache guide and it worked! I ran the gatsby clean script to clean the cache and it worked! Thanks for the help @oorestisime

Hey! glad you found it! and yes your cache folder should be in the gitignore. The cache on netlify is not going to be persisted and that is ok.
If you want however to persist it for perf issues you might want to have a look at this https://github.com/axe312ger/gatsby-plugin-netlify-cache