Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error ENOENT: no such file or directory, open '/opt/build/cache/cwd/.cache.netlify.cache.json' #1411

Closed
ehmicky opened this issue Jun 2, 2020 · 18 comments · Fixed by #1772
Closed
Assignees
Labels
type: bug code to address defects in shipped code

Comments

@ehmicky
Copy link
Contributor

ehmicky commented Jun 2, 2020

The following error (or a variant) is thrown in some build logs:

Error: ENOENT: no such file or directory, open '/opt/build/cache/cwd/.cache.netlify.cache.json' 

This was also reported in jlengstorf/netlify-plugin-gatsby-cache#24.

Bugsnag error

Other Bugsnag error

@ehmicky
Copy link
Contributor Author

ehmicky commented Jun 2, 2020

This issue has been linked to an error in Bugsnag
pluginInternal in Plugin "netlify-plugin-hugo-cache-resources" internal error

@ehmicky
Copy link
Contributor Author

ehmicky commented Jun 2, 2020

Core bug

Comment added in Bugsnag by Mickael Hebert
pluginInternal in Plugin "netlify-plugin-hugo-cache-resources" internal error

@cdeleeuwe
Copy link

@ehmicky Is there any workaround I could implement to fix this issue in the netlify-plugin-hugo-cache-resources plugin?

@ehmicky
Copy link
Contributor Author

ehmicky commented Jul 24, 2020

Hi @cdeleeuwe,

I am witnessing this bug in production, but am having trouble reproducing it. Did you manage to reproduce it?

@SathyaBhat
Copy link

I opened an issue on @cdeleeuwe's github. This seems to be happening on my website, https://github.com/sathyabhat/sathyasays.com

I removed the plugin and installed again but without success.

@ehmicky
Copy link
Contributor Author

ehmicky commented Jul 24, 2020

@SathyaBhat, is this happening consistently?
If so, would it be possible for you to share a link to your deploy logs? Thanks!
Edit: I found your deploy logs. It does seem to appear consistently in your case.

@ehmicky
Copy link
Contributor Author

ehmicky commented Jul 24, 2020

I managed to reproduce this problem in a fork: deploy logs, PR

@ehmicky
Copy link
Contributor Author

ehmicky commented Jul 24, 2020

This is fixed by #1710.
I will update this issue once the fix is in production.

@ehmicky
Copy link
Contributor Author

ehmicky commented Jul 24, 2020

An error linked to this issue has been marked as fixed in Bugsnag
pluginInternal in Plugin "netlify-plugin-hugo-cache-resources" internal error

@ehmicky
Copy link
Contributor Author

ehmicky commented Aug 10, 2020

An error linked to this issue has been reopened in Bugsnag
pluginInternal in Plugin "netlify-plugin-hugo-cache-resources" internal error

@tilsammans
Copy link

Hi @ehmicky did you manage to deploy the fix?

Today it's still a bug for me with the Hugo Cache Resources plugin. Anything to do for the plugin authors?

@cdeleeuwe
Copy link

@tilsammans For now I have pushed a workaround fix. Hopefully this fixes the problem for you.

@tilsammans
Copy link

Hey @cdeleeuwe thanks for looking into it! Unfortunately, Hugo Cache Resources is still broken.

2:54:33 PM:   Error: ENOENT: no such file or directory, open '/opt/build/cache/cwd/resources.netlify.cache.json'
2:54:33 PM: ​
2:54:33 PM:   Plugin details
2:54:33 PM:   Package:        netlify-plugin-hugo-cache-resources
2:54:33 PM:   Version:        0.1.4
2:54:33 PM:   Repository:     git+https://github.com/cdeleeuwe/netlify-plugin-hugo-cache-resources.git
2:54:33 PM:   npm link:       https://www.npmjs.com/package/netlify-plugin-hugo-cache-resources
2:54:33 PM:   Report issues:  https://github.com/cdeleeuwe/netlify-plugin-hugo-cache-resources/issues
2:54:33 PM: ​
2:54:33 PM:   Error location
2:54:33 PM:   In "onPostBuild" event in "netlify-plugin-hugo-cache-resources" from Netlify app
2:54:33 PM: ​
2:54:33 PM:   Error properties
2:54:33 PM:   {
2:54:33 PM:     errno: -2,
2:54:33 PM:     code: 'ENOENT',
2:54:33 PM:     syscall: 'open',
2:54:33 PM:     path: '/opt/build/cache/cwd/resources.netlify.cache.json'
2:54:33 PM:   }

@cdeleeuwe
Copy link

@tilsammans sure no problem. Actually, I pushed the fix in version 0.1.5 and master, but it hasn't been updated in Netlify yet (PR is still open netlify/plugins#131).

Not sure if you have enabled the plugin through the Netlify UI or netlify.toml file, but if you want to use it now, you can use the latest version through the netlify.toml file.

@ehmicky
Copy link
Contributor Author

ehmicky commented Aug 26, 2020

Hi @tilsammans and @cdeleeuwe,

The fix mentioned above was deployed to production and solved some of the *.netlify.cache.json errors. However, the bug was still happening when trying to cache empty nested directories (e.g. /resources/assets/ in the Hugo cache plugin case). I created a PR at #1772 that fixes this problem. I managed to reproduce the bug, so this PR should do the job.

Once deployed to production, I will update this PR. In the meantime, the workaround mentioned by @cdeleeuwe also works (note: that workaround can be removed if you want once the PR above is in production).

@cdeleeuwe
Copy link

Awesome, thanks a lot @ehmicky ! OK, will remove the workaround once it's merged.

@ehmicky
Copy link
Contributor Author

ehmicky commented Sep 10, 2020

I can confirm this bug is now fixed in production.

@tilsammans
Copy link

Yes, also confirmed! Good work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants