Unable to read file error appears when deploying a website

I build SSG website with react gatsby.js using Gatsby Static Image to pre-render some images. There’s no problem while serving on localhost but when I try to deploy on Netlify if I drag the build folder to the deploy section, “A requested file or directory could not be found at the time an operation was processed.” A message error will appear. I have to browse directly from the browser and then “Unable to read file [StaticImage file name]” will be showed up and stop the deployment. This happened only if I use StaticImage and it seems to happen on some image (An Image get source from Firebase Storage). I have deployed the same build folder on Cloudflare and it works perfectly.

Hard to say from this block of text without seeing any site build logs or other information. Would you be willing to share any of that?

1 Like

It looks like there is no deployment log showing up because it failed during the upload process. Here is the image capture of what it’s happened when I uploaded the build folder.

By looking at the screenshot, it appears that your file name has various non ASCII characters. Could you share the name of the file?

Also, make sure you don’t have any extensions/scripts like ad-blockers or antivirus programs, etc. that could affect the connection to Netlify.

Sure, here is the name of the file MV%2FVivi%2F%5BMV%5D%20%EC%9D%B4%EB%8B%AC%EC%9D%98%20%EC%86%8C%EB%85%80_ViVi%20(LOONA_%EB%B9%84%EB%B9%84)%20%E2%80%9CEveryday%20I%20Love%20You%20(Feat.%20HaSeul)%E2%80%9D%200-26%20screenshot-remini-enhanced.webp src

After I thoroughly investigate on deployment, I found that some static images that caused “Unable to read file” on Netlify are not render properly on Cloudflare. It only render the placeholder image of its lazy load

Here is how “MV%2FVivi%2F%5BMV%…webp” rendered on my Cloudflare deployment.

I think, If I make all StaticImages render properly this should fix the problem and will be able to deploy on Netlify.

This is the URL without encoding:

https://firebasestorage.googleapis.com/v0/b/loona-4186d.appspot.com/o/MV/Vivi/[MV] 이달의 소녀_ViVi (LOONA_비비) “Everyday I Love You (Feat. HaSeul)” 0-26 screenshot-remini-enhanced.webp?alt=media&token=79e62831-585b-4518-9804-849ca5a6351b

I think the long name along with non ASCII characters are causing issues. What happens if you try to keep a simpler name?