setup-node icon indicating copy to clipboard operation
setup-node copied to clipboard

v3.8.0 - "Cache folder paths are not retrieved for..."

Open sammarks opened this issue 3 years ago • 20 comments

Description: It looks like there might have been a breaking change in the latest version of the action. With the following configuration:

- uses: actions/setup-node@v3
  with:
    node-version: 18
    cache: 'pnpm'

I'm getting during the cleanup step:

Cache folder paths are not retrieved for pnpm with cache-dependency-path = 

Action version: v3.8.0 - This only started happening within the last 2 hours, and 3.8.0 was released 2 hours ago so that makes me believe there's an issue with the latest release.

Platform:

  • [x] Ubuntu
  • [ ] macOS
  • [ ] Windows

Runner type:

  • [x] Hosted
  • [ ] Self-hosted

Tools version: Node 18, PNPM 7.9.0

Repro steps:
Create a workflow with the following step:

- uses: actions/setup-node@v3
  with:
    node-version: 18
    cache: 'pnpm'

Expected behavior: I expect the post-setup step to succeed.

Actual behavior: It fails with an error message instead.

sammarks avatar Aug 14 '23 12:08 sammarks

Confirming it works fine if I downgrade to 3.7.0 inside my workflow.

sammarks avatar Aug 14 '23 12:08 sammarks

Can confirm. Getting the same error with the latest version (3.8.0) - works again by downgrading to version 3.7.0.

urbanisierung avatar Aug 14 '23 12:08 urbanisierung

Hello everyone. Could you please provide a public repository to take a look at the build?

dmitry-shibanov avatar Aug 14 '23 13:08 dmitry-shibanov

Hello everyone. It looks like the pnpm store path --silent command produces the warning regarding to workspaces. Could you please try to add pnpm-workspace.yaml or remove workspaces section from package.json ?

dmitry-shibanov avatar Aug 14 '23 15:08 dmitry-shibanov

Ah, could it be warnings output by pnpm store path before outputting the store path? I have an NPM_TOKEN variable in my .npmrc file. Since I do installation in another step, that variable isn't set during the Node setup step. PNPM throws a warning at the beginning of execution saying that variable isn't set, but then it outputs properly.

In the past, I believe the node setup action has just ignored the warnings and used the last line of output. Perhaps something was changed with the 3.8 release that made it try and interpret the first line as the result instead?

Yep; this is the output I get when running pnpm store path --silent with a bogus environment variable:

 WARN  Issue while reading "/Users/sammarks/Code/xxxx/.npmrc". Failed to replace env in config: ${GITHUB_TOKENN}
 WARN  Issue while reading "/Users/sammarks/Code/xxxx/.npmrc". Failed to replace env in config: ${GITHUB_TOKENN}
/Users/sammarks/Library/pnpm/store/v3

I've kept the version of PNPM constant this whole time so this warning can't be new on PNPM's part.

sammarks avatar Aug 14 '23 15:08 sammarks

Whatever it was, it was a breaking change with a minor version bump. Affected Actions for us as well. :smile:

bryanspears avatar Aug 14 '23 17:08 bryanspears

Hello everyone. Could you please try to use actions/setup-node@main to confirm that it works for you?

dmitry-shibanov avatar Aug 15 '23 13:08 dmitry-shibanov

The error above-mentioned is resolved, but it does not works for me. It still fails during the post job cleanup while message is different as follows:

Error: Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.

I tried with the following step:

- uses: actions/setup-node@main
  with:
    node-version: 18
    cache: 'pnpm'

t-jimbo avatar Aug 15 '23 15:08 t-jimbo

Hello @t-jimbo. Could you please send the build ? If it is not possible to provide a public build could you please provide logs with enabled debug step ?

dmitry-shibanov avatar Aug 15 '23 15:08 dmitry-shibanov

Hi @dmitry-shibanov. Here you are.

I assume it relates to #801

Logs - Post Run actions/setup-node@main
##[debug]Evaluating condition for step: 'Post Run actions/setup-node@main'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Post Run actions/setup-node@main
##[debug]Loading inputs
##[debug]Evaluating: (((github.server_url == 'https://github.com') && github.token) || '')
##[debug]Evaluating Or:
##[debug]..Evaluating And:
##[debug]....Evaluating Equal:
##[debug]......Evaluating Index:
##[debug]........Evaluating github:
##[debug]........=> Object
##[debug]........Evaluating String:
##[debug]........=> 'server_url'
##[debug]......=> 'https://github.com'
##[debug]......Evaluating String:
##[debug]......=> 'https://github.com'
##[debug]....=> true
##[debug]....Evaluating Index:
##[debug]......Evaluating github:
##[debug]......=> Object
##[debug]......Evaluating String:
##[debug]......=> 'token'
##[debug]....=> '***'
##[debug]..=> '***'
##[debug]=> '***'
##[debug]Expanded: ((('https://github.com' == 'https://github.com') && '***') || '')
##[debug]Result: '***'
##[debug]Loading env
Post job cleanup.
##[debug]Checking zstd --quiet --version
##[debug]1.5.5
##[debug]zstd version: 1.5.5
##[debug]implicitDescendants 'false'
##[debug]followSymbolicLinks 'true'
##[debug]implicitDescendants 'false'
##[debug]omitBrokenSymbolicLinks 'true'
##[debug]Search path '/home/runner/setup-pnpm/node_modules/.bin/store/v3'
##[debug]Cache Paths:
##[debug][]
Error: Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.
##[debug]Node Action run completed with exit code 1
##[debug]Finishing: Post Run actions/setup-node@main

t-jimbo avatar Aug 15 '23 16:08 t-jimbo

@t-jimbo. Which versions of Nodejs and Pnpm do you use? Do you use composite action? Could you please add a step before cleanups to check that path: /home/runner/setup-pnpm/node_modules/.bin/store/v3 exists ?

dmitry-shibanov avatar Aug 15 '23 16:08 dmitry-shibanov

bumping back to 3.7.0 for us also worked

chrisadubois avatar Aug 15 '23 19:08 chrisadubois

Hello everyone. Could you please try to use actions/setup-node@main to confirm that it works for you?

It worked for me after updating it to actions/setup-node@main

plato-juan avatar Aug 15 '23 21:08 plato-juan

Hello @chrisadubois. If the repository is public could you please provide a build ?

dmitry-shibanov avatar Aug 15 '23 22:08 dmitry-shibanov

Which versions of Nodejs and Pnpm do you use? Do you use composite action? Could you please add a step before cleanups to check that path: /home/runner/setup-pnpm/node_modules/.bin/store/v3 exists ?

Ah, sorry. It was my fault. It worked after changing path provided for actions/cache from node_modules to '**/node_modules'. It seems cache path is no longer resolved with just node_modules.

[FYI] worked with following:
- uses: actions/checkout@v3 
- uses: pnpm/action-setup@v2
  with:
    version: 8
  
- uses: actions/setup-node@main
  with:
    node-version: 18
    cache: 'pnpm'

- uses: actions/cache@v3
  id: pnpm-cache
  with:
    path: '**/node_modules'
    key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
    restore-keys: |
      ${{ runner.os }}-pnpm-store-
  
- name: Install dependencies
  if: steps.pnpm-cache.outputs.cache-hit != 'true'
  run: pnpm install --frozen-lockfile
  env:
    NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

t-jimbo avatar Aug 16 '23 04:08 t-jimbo

Hello everyone. Could you please try to use actions/setup-node@main to confirm that it works for you?

@dmitry-shibanov Thanks for the quick fix here -- do you have an ETA for when this will be released?

jimjasson avatar Aug 17 '23 11:08 jimjasson

Hello everyone. We released a new version of setup-node (3.8.1). For now I'm going to close the issue.

dmitry-shibanov avatar Aug 21 '23 11:08 dmitry-shibanov

Still not working for me, using actions/setup-node@v3 (5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d). Getting the following error:

Error: Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.

I'm using the action like this:

    - name: Setup node
      uses: actions/setup-node@v3
      with:
        cache: pnpm

decline avatar Aug 21 '23 12:08 decline

Hello @decline. Could you please send the public build ?

dmitry-shibanov avatar Aug 21 '23 15:08 dmitry-shibanov

We are also affected by this issue. I just tried downgrading to 3.7.0, but still got the error. Here is the last failed job.

Looking at the logs, pnpm says that the store is located at /home/runner/.pnpm-store/. But, actions/setup-node says that the store is located at /home/runner/setup-pnpm/node_modules/.bin/store/v3.

I'm guessing this is some kind of a path conflict with pnpm/action-setup, and there might be two pnpm binaries.

netroy avatar Aug 21 '23 18:08 netroy