Summary
When running Parcel during a deployment, it fails with
🚨 /opt/build/repo/website/resources/denys-nevozhai-3i5kX5LVDV0_450.jpg: ENOENT: no such file or directory, open '/opt/build/repo/website/resources/denys-nevozhai-3i5kX5LVDV0_450.jpg'
This file is present both in Netlify and on Git.
Debug attempts
I’ve verified that the files exist in Netlify by prepending echo $PWD && ls -l && ls -l resources to the build command. This outputs
As you can see, the file exists and is in the correct directory.
I am suspecting that this is a Parcel issue, since the other support thread with this problem also uses Parcel, and the file seems to exist in the the deployment VM. Regardless, I posted here for Netlify-specific input.
The error is thrown by an fs.createReadStream(...) inside Parcel (specifically in utils/md5.file). It seems like the actual open syscall errors.
The error does not occur if you use fs.readFileSync(...) before Parcel is run. It does occur if you do so after. The file is however visible using fs.readdirSync(...) no matter what, even when fs.readFileSync(...) will fail.
The error somehow got fixed after I messed around with the filename. It works after I change it to test_450.jpg, then also worked when I revert it back. That… seems really weird. I’m not sure how any state is able to persist across different deployments to affect this.
In conclusion this seems like a really weird interaction between Netlify and Parcel, which causes the open syscall to fail after Parcel has run in some cases.
Also going to just link the issue I opened on Parcels’ GitHub, in case any additional information appears there. However, considering that this seems like the actual open syscall fails, I think this is mostly in Netlify’s court.
Hi, @birjolaxew, welcome to our Netlify community site and … wow. This is an amazingly well researched and documented issue.
I also didn’t see any explanation for this as I also see the file present and named correctly. Case-sensitivity issues are known to cause issues like this but the case matches exactly.
I’m asking my colleagues to take a look as well and we hope to have more information for you soon.
to Luke’s point @birjolaxew, I am also still worried about case sensitivity and the “test_450” file working makes me think that may be related, still. However, while investigating, I saw this line in your error output from one of your last failed builds:
…which has 2 dashes in it after denys. I guess that isn’t the case in what you pasted…but it is what I see in the deploy logs, similar to Asgeir’s entry in your paste here: (asgeir-pall-juliusson--90...)
@fool That file name is from when I was attempting to debug by removing parts of the filename. After I saw that it worked after renaming to test.jpg, I was wondering if somehow a specific part of the filename was triggering the bug. In a previous build I had also tried simply 3i5kX5LVDV0_450.jpg. Eventually I reverted back to the original filenames, which somehow worked. That’s the most confusing part to me. Both of those builds are of the debug branch, so they might be a bit messy. The relevant commits on master are 5923f2 (fails), 70c1b1 (succeeds) and b1d32a (succeeds).
As for Asgeir’s entry, that’s simply because the photo’s Unsplash ID starts with a dash
Eventually found out that you guys were right - the L in 3i5kX5LVDV0 was uppercase in my require, but lowercase in my filename. Guess I must’ve updated it when I named the file back to its “original” filename. I’ll have to take a look at how the Git ended up differing from my local system, but this definitely isn’t a Netlify issue.