Apologies in advance if this is an obvious issue but I’ve searched and can’t find a solution.
I have a Netlify site built with Gatsby.
I made a new commit today and the site rebuilt with no problems. However, when I looked at the page it was missing two of the images. Error in the console is:
“Failed to load resource: the server responded with a status of 404”
I did not change any code concerning these images, they always worked fine previously and when I set the site to use a previously working deploy the images still aren’t there.
The images are totally fine in the gatsby dev environment and totally fine when I build and serve the site locally. They’re definitely in the connected git repo.
To make matters even more confusing, I have done a number of builds since this issue arose (as I’ve been changing other, unrelated things) and on one of the builds the images were fine!
The images are displayed using gatsby-image. Not sure if that’s relevant. Other images using the exact same template/equivalent queries are totally fine.
I’m having a similar issue as well. I find that uploading the /public folder directly from a local build and serve will preserve all the images, but I would love a solution where I can rely on auto-publishing to update my site instead of needing to log in and upload files every time.
I’ve checked the site download, and those images are not in the build’s static files.
A few of these images have been resized and reformatted (from png to jpg) to reduce their sizes.
I clear cache often locally, and since this issue began, on Netlify as well before deploying. Interestingly, which images show up in the build differ from deploy to deploy. Not sure how that happens.
Hi, have you checked your earlier commits before this started happening to see if you updated any of your dependencies? In our build environment all we’re doing is cloning your repo, installing your dependencies, and then running the build command you specify. Your build should be repeatable given the same dependencies and source files.
Thanks! This issue started happening after updating Gatsby for the first time in this project. Someone recently opened up a similar issue in the Gatsby repo so I’ll be following that as well! Thank you again.
Hi @JessAbejar, I’ve been experiencing the same issues when updating Gatsby. Can you post a link to the issue in the Gatsby repo? This would be much appreciated!
Also, have you experienced blank pages when the page refreshes after updating?
I’m having this same issue. I have a static html site. Just an index.html file with a css folder, and js folder. All assets are hosted locally through the repo. No outside requests. On my local, it finds all assets. If I drag and drop my site, it finds all assets. If I deploy through the repo, it does not find all assets. None of the assets are being gitignored - and having downloaded the deploy zip file, all assets exist. Since it is an simple html site, I am not specifying any build commands. The default directory I left blank. I also tried setting the default directory to “/” as well as placing them all in a public folder and specifying the “public” default directory – it is still not finding the assets. You can see for yourself.
Hi, @jfny. Netlify won’t modify your site paths so this is being done by the site build process not Netlify.
The solution for this will be specific to your site code so it will help to know more about that to answer. Which static site generator (or other build process) is being used to build this site?
I was having the exact same problem when specifying the background image using background-image: url(...); . I am using Jekyll, so I just produced the site locally with the same environment variables I was using on Netlify, and the URL did not have the strange hash inserted.
So, next I check my under my site’s settings. If you navigate to Settings > Build & Deploy > Post Processing > Asset Optimization, you will see a setting to Bundle/Minify CSS files. I unchecked both, and re-deployed my site. Sure enough, the URL was correct. I hope this helps you out, and whoever else stumbles upon this post from Google (as I did).
we use tools like HTMLCruncher (html-cruncher - npm). Some are home-written.
If the asset optimization doesn’t work well with your code, my suggestion is to turn it off, since the optimization code is not much visited and unlikely to change in the near future…and you can choose to minify/etc during your build should you so desire