toolkit icon indicating copy to clipboard operation
toolkit copied to clipboard

Cache Service Url not found, unable to restore cache

Open dapplion opened this issue 4 years ago • 5 comments

Using the cache package identically as the actions/cache@v2 action it breaks with

Error: getCacheEntry failed: Cache Service Url not found, unable to restore cache.
    at /home/runner/work/benchmark/benchmark/node_modules/@actions/cache/src/internal/requestUtils.ts:92:9
    at Generator.next (<anonymous>)
    at fulfilled (/home/runner/work/benchmark/benchmark/node_modules/@actions/cache/lib/internal/requestUtils.js:5:58)

Why are the ACTIONS_CACHE_URL ACTIONS_RUNTIME_URL only available in the action? Who magically injects them and when?

If this is not a bug, is this page meant to be used exclusively within the Github action and never on its own?

dapplion avatar Jun 24 '21 18:06 dapplion

Bump @dhadka @bryanmacfarlane @jclem @konradpabjan @dhadka (sorry for tagging you I'm not sure you have notifications enabled for this repo :pray: )

dapplion avatar Jun 30 '21 14:06 dapplion

@dapplion are you using a composite action? I had to change from composite action to a nodejs action to get the variables injected.

sidharthv96 avatar Aug 30 '21 04:08 sidharthv96

Unfortunately, these 2 variables are for internal use only, see https://github.com/nektos/act/issues/329#issuecomment-766960494.

If this is not a bug, is this page meant to be used exclusively within the Github action and never on its own?

I would appreciate the README to explicitly state this.

shichen85 avatar Jan 12 '22 18:01 shichen85

Can confirm what @sidharthv96 experienced. When using composite custom action, caching from @actions/cache would not work, internal env vars were not being populated. After converting to JavaScript custom action, it worked out of the box.

alexkuc avatar Aug 14 '23 07:08 alexkuc

I'm finding the opposite (not sure if it's related). I'm using @actions/cache as a library and find that cache.isFeatureAvailable() is always returning false, within a CI run on my custom action (running on Github Actions).

ohookins avatar Feb 05 '24 06:02 ohookins