netlify-plugin-cache icon indicating copy to clipboard operation
netlify-plugin-cache copied to clipboard

Attempted to cache: .cache ... but failed. :(

Open nomeata opened this issue 3 years ago • 4 comments

I am trying to use this plugin, but I get the relatively unhelpful message

11:17:54 PM: ────────────────────────────────────────────────────────────────
11:17:54 PM:   5. netlify-plugin-cache (onSuccess event)                     
11:17:54 PM: ────────────────────────────────────────────────────────────────
11:17:54 PM: ​
11:17:56 PM: Attempted to cache: .cache ... but failed. :(
11:17:56 PM: Try setting the 'paths' input appropriately in your netlify.toml configuration.
11:17:56 PM: More details: https://jrvs.io/netlify-cache-usage
11:17:56 PM: ​
11:17:56 PM: (netlify-plugin-cache onSuccess completed in 2s)

I have

[[plugins]]
package = "netlify-plugin-cache"
  [plugins.inputs]
  paths = [".cache"]

and my build command really writes stuff to .cache.

What could that be? And could the error message be more helpful?

nomeata avatar Feb 16 '22 22:02 nomeata

I'm investigating this right now. Probably, the bug hides in Netlify's build tool cache utility, that wasn't updated for the last year, maybe something was changed on the backend. There is no way the bug in the plugin, it's too simple to fail anywhere :)

maddsua avatar Mar 18 '23 23:03 maddsua

@nomeata Any updates? The only thing I suspect now is bad file paths. Somehow, Node just does that from time to time.

When the plugin says that it did something to 2 files, it actually means 1 folder specified by the user, and node_modules directory. Yeahhh, good luck figuring it out without digging.

Tested in one of my projects, seems to work without a hiccup. The config's down below (yes, I'm using tabs for indentation):

[[plugins]]
	package = "netlify-plugin-cache"
	[plugins.inputs]
		paths = ["assets/.cache"]

maddsua avatar Mar 25 '23 22:03 maddsua

TLDR: Try a path that does not start with a dot. Maybe they put a regex for path transforms that is shooting back

maddsua avatar Mar 25 '23 23:03 maddsua

No updates, sorry. I think I even forgot what precisely I was trying to do back then, and found some workaround

nomeata avatar Mar 26 '23 07:03 nomeata