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?

I have the same problem. but your system is more precise: he does not recognize the index.html that is indeed at the root of my folder.
It is a hugo multilingual site, but it absolute works.

index.html

<!doctype html><html lang=fr-FR><title>http://psychototale.com/fr/</title>
<link rel=canonical href=http://psychototale.com/fr/><meta name=robots content="noindex"><meta charset=utf-8><meta http-equiv=refresh content="0; url=http://psychototale.com/fr/">

@guyclaude I don’t understand.

  • What is the site URL on Netlify?
  • What is the error?
  • Is there a public repository?

There is no repository because github is unusable to me, same for codeberg etc… Just no.
I tried with Google Drive and it also said essentially “file unreadable” and refused three files, but without saying which nor why ! The best I could do is store a compressed version of the repository.
The url is : https://psychototale.com/
The error is that whenever I try to push it netlify says “Unable to read file”

Could you try to record a video that shows what you’re trying to do?

I’m just trying to upload the website which has been built under a /public directory, as I do every single time for other websites, and as I used to do before.
Did you try uploading public/ inside psychototale-essai ?

@guyclaude I do not encounter the same issue, I was able to do a test deployment of your site here:

https://65dbc098145040320990d543--zingy-unicorn-704996.netlify.app/

I did have to change the refresh meta in the /index.html though that pushes to /fr/ (as otherwise it pushed to psychototale.com which isn’t working - which is also why many links won’t work on it).

Netlify’s “Drag & Drop” feature is more error prone than other ways of deploying sites, if you’re having issues with it you could try the CLI:
https://docs.netlify.com/cli/get-started/

Since you have a pre-built site you would just need to authorize it, then use Manual Deploys:
https://docs.netlify.com/cli/get-started/#manual-deploys

I do not use adblock.
The CLI has been failing on me for a whole year.
That goes for all calls to netlify… init, login, deploy, whatever.

Logging into your Netlify account...
Opening https://app.netlify.com/authorize?response_type=ticket&ticket=31f2e302820aa3fa7306cbf6596d3620
⠋ Waiting for authorization...
 ›   Error: Netlify CLI has terminated unexpectedly
This is a problem with the Netlify CLI, not with your application.
If you recently updated the CLI, consider reverting to an older version by running:

npm install -g netlify-cli@VERSION

You can use any version from https://ntl.fyi/cli-versions.

Please report this problem at https://ntl.fyi/cli-error including the error details below.

⠙ Waiting for authorization...Error: spawn chromium --enable-features=UseOzonePlatform --ozone-platform=wayland ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:284:19)
    at onErrorNT (node:internal/child_process:477:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

  System:
    OS: Linux 6.6 Debian GNU/Linux trixie/sid
    CPU: (6) x64 AMD FX(tm)-6100 Six-Core Processor
  Binaries:
    Node: 18.19.0 - /usr/local/bin/node
    npm: 10.4.0 - /usr/local/bin/npm
  Browsers:
    Firefox: 115.7.0esr
  npmGlobalPackages:
    netlify-cli: 17.17.0

Then I enter this url into my browser, validate the authentification… and nothing happens, I don’t even find the token in my account.

@guyclaude Have you reported it as an error via the link it provides?:
https://ntl.fyi/cli-error

I don’t normally use the Netlify CLI myself but I had no problem installing node 18.19.0 and then the netlify-cli 17.17.0 and executing netlify login.

I’m not sure what you mean by:

I mean I disabled adblocker when using netlify.
Ok I’ve risen an issue .

@guyclaude I’m no expert, but the issue with the CLI appears to be occurring as it tries to spawn the browser for you to login. The error log message indicates you have Firefox.

On my system (Arch Linux) it has no issue spawning the browser, and did so with Firefox.

It may be system related on your end but logging the issue would be your best bet as they’ll have a better idea than me.

I had endeavouros just a few weeks ago, same thing.
So “bad luck” huh, so very usual with me…

You could mention that in your ticket too.

1 Like