[GH-ISSUE #1034] Issue: Cache service responded with 404 with actions/setup-node@v2 #602

Open
opened 2026-03-01 21:44:52 +03:00 by kerem · 7 comments
Owner

Originally created by @aib on GitHub (Mar 11, 2022).
Original GitHub issue: https://github.com/nektos/act/issues/1034

(I'm skipping the issue template since this looks more like an oversight or missing feature than a bug.)

actions/setup-node@v2, when run with cache: npm, fails with "::error::Cache service responded with 404".

To replicate, one can clone https://github.com/aib/act-setup-node-test and run act --artifact-server-path /tmp/act-artifacts -j test. Edit: Or use the following workflow file:

name: Test
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
        with:
          node-version: 16.14.0
          cache: 'npm'
      - run: npm --version

Tested against release v0.2.25 and current master.

The requested URL looks like http://127.0.0.1:34567/_apis/artifactcache/cache?keys=node-cache-Linux-npm-4ae58fb93f5d99af5b6b62d6ba7d42110a267626bfc1d6847922d9e6863ef729&version=b3f0cb83629d634645a5146420c017462ebb5229bd60271a7a86e489a6066469 and seems to be generated by https://github.com/actions/toolkit/blob/main/packages/cache/src/internal/cacheHttpClient.ts#L33 .

A workaround is returning HTTP 204 to the request. An actual caching implementation should be easy, too, but I'm not familiar enough with act, GitHub Actions or even Go to submit a PR. (And in any case I'd need an issue # to reference)

Originally created by @aib on GitHub (Mar 11, 2022). Original GitHub issue: https://github.com/nektos/act/issues/1034 (I'm skipping the issue template since this looks more like an oversight or missing feature than a bug.) `actions/setup-node@v2`, when run with `cache: npm`, fails with "::error::Cache service responded with 404". To replicate, one can clone https://github.com/aib/act-setup-node-test and run `act --artifact-server-path /tmp/act-artifacts -j test`. Edit: Or use the following workflow file: ``` name: Test jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v2 with: node-version: 16.14.0 cache: 'npm' - run: npm --version ``` Tested against release v0.2.25 and current master. The requested URL looks like `http://127.0.0.1:34567/_apis/artifactcache/cache?keys=node-cache-Linux-npm-4ae58fb93f5d99af5b6b62d6ba7d42110a267626bfc1d6847922d9e6863ef729&version=b3f0cb83629d634645a5146420c017462ebb5229bd60271a7a86e489a6066469` and seems to be generated by https://github.com/actions/toolkit/blob/main/packages/cache/src/internal/cacheHttpClient.ts#L33 . A workaround is returning HTTP 204 to the request. An actual caching implementation should be easy, too, but I'm not familiar enough with act, GitHub Actions or even Go to submit a PR. (And in any case I'd need an issue # to reference)
Author
Owner

@KnisterPeter commented on GitHub (Mar 15, 2022):

Hi @aib,
the asset server implementation in act currently does not support the github caching API.
It only supports the artifact upload/download from jobs.

<!-- gh-comment-id:1067684744 --> @KnisterPeter commented on GitHub (Mar 15, 2022): Hi @aib, the asset server implementation in act currently does not support the github caching API. It only supports the artifact upload/download from jobs.
Author
Owner

@ZauberNerd commented on GitHub (Mar 15, 2022):

See also this comment for a solution to disable cache in the setup-x actions when running in act while still allowing cache on GitHub actions: https://github.com/nektos/act/issues/989#issuecomment-1059758786

<!-- gh-comment-id:1067691291 --> @ZauberNerd commented on GitHub (Mar 15, 2022): See also this comment for a solution to disable cache in the `setup-x` actions when running in act while still allowing cache on GitHub actions: https://github.com/nektos/act/issues/989#issuecomment-1059758786
Author
Owner

@aib commented on GitHub (Mar 15, 2022):

Ahh, I see. Thanks.

<!-- gh-comment-id:1067699648 --> @aib commented on GitHub (Mar 15, 2022): Ahh, I see. Thanks.
Author
Owner

@3Nigma commented on GitHub (Oct 4, 2022):

Hey guys! I was able to use

    - name: Bringing node v16
      uses: actions/setup-node@v3
      with:
        node-version: 16
        cache: 'npm'
        cache-dependency-path: client

in act with a modified version of JEFuller's code written by me, conveniently named github-cache-server. 😊

image

This also works great with act's --artifact-server-path if you're planning to use the artifact server as well.

Cheers 🍻

<!-- gh-comment-id:1267200793 --> @3Nigma commented on GitHub (Oct 4, 2022): Hey guys! I was able to use ``` - name: Bringing node v16 uses: actions/setup-node@v3 with: node-version: 16 cache: 'npm' cache-dependency-path: client ``` in `act` with a modified version of [JEFuller's code](https://github.com/JEFuller/artifact-server) written by me, conveniently named [github-cache-server](https://github.com/buidler-labs/github-cache-server). 😊 ![image](https://user-images.githubusercontent.com/210908/193867762-60fdd637-0501-48b2-ae64-e46113057bef.png) This also works great with `act`'s `--artifact-server-path` if you're planning to use the artifact server as well. Cheers 🍻
Author
Owner

@iSplasher commented on GitHub (Mar 26, 2023):

Would it be possible to integrate this directly into act?

<!-- gh-comment-id:1484198300 --> @iSplasher commented on GitHub (Mar 26, 2023): Would it be possible to integrate this directly into act?
Author
Owner

@3Nigma commented on GitHub (Mar 27, 2023):

Would it be possible to integrate this directly into act?

I would have, but I don't speak GO 😔

<!-- gh-comment-id:1484552364 --> @3Nigma commented on GitHub (Mar 27, 2023): > Would it be possible to integrate this directly into act? I would have, but I don't speak GO 😔
Author
Owner

@shmuli9 commented on GitHub (Jan 11, 2025):

Hey guys! I was able to use

    - name: Bringing node v16
      uses: actions/setup-node@v3
      with:
        node-version: 16
        cache: 'npm'
        cache-dependency-path: client

in act with a modified version of JEFuller's code written by me, conveniently named github-cache-server. 😊

image

This also works great with act's --artifact-server-path if you're planning to use the artifact server as well.

Cheers 🍻

How do you set this up in your workflow file?

<!-- gh-comment-id:2585461839 --> @shmuli9 commented on GitHub (Jan 11, 2025): > Hey guys! I was able to use > > ``` > - name: Bringing node v16 > uses: actions/setup-node@v3 > with: > node-version: 16 > cache: 'npm' > cache-dependency-path: client > ``` > > in `act` with a modified version of [JEFuller's code](https://github.com/JEFuller/artifact-server) written by me, conveniently named [github-cache-server](https://github.com/buidler-labs/github-cache-server). 😊 > > ![image](https://user-images.githubusercontent.com/210908/193867762-60fdd637-0501-48b2-ae64-e46113057bef.png) > > This also works great with `act`'s `--artifact-server-path` if you're planning to use the artifact server as well. > > Cheers 🍻 How do you set this up in your workflow file?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#602
No description provided.