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

Frequent EACCES: permission denied errors with Docker image cypress/included:9.1.1 #560

Closed
mauricedb opened this issue Dec 15, 2021 · 12 comments

Comments

@mauricedb
Copy link

Recently I have been seeing frequent EACCES: permission denied errors while running GitHub actions.

They all seem to be around the /root/.cache/Cypress folder. I am under the impression this started when Cypress 9.0.0 was released.

Some examples:

This only seems to happen in GitHub Actions that are using the cypress/included:9 Docker image. Other ones that don't use the Docker image run just fine.

@FabianBruengerDedalus2
Copy link

FabianBruengerDedalus2 commented Dec 16, 2021

Hey, i just wanted du fire up (almost) the same issue. I am running the image 9.1.1 as a job container:

(The image is cypress/included:9.1.1, just the wrong screenshot)
Bildschirmfoto 2021-12-16 um 13 14 56

And then i am trying to start cypress:
Bildschirmfoto 2021-12-16 um 13 17 42

This is my error:
Bildschirmfoto 2021-12-16 um 13 19 22

If i am running the container manually on my machine everything works fine. I would appreciate some help.

Cheers

@mauricedb
Copy link
Author

FYI. This is still happening with the Cypress 9.2.0 images.
[FAILED] EACCES: permission denied, unlink '/root/.cache/Cypress/9.2.0/binary_state.json'

The same build running with image: cypress/included:8.7.0 works just fine.

@FabianBruengerDedalus2
Copy link

Hi @mauricedb, thx for the info. I also tested older version and it is running fine, I just missed to put the info here. I am also running on 8.7.0 now. I hope this is fixed soon. Cheers!

@mjhenkes
Copy link
Member

mjhenkes commented Jan 4, 2022

Can you try the work around mentioned here: cypress-io/github-action#446 (comment)

configuring the job to run as a non root user.

@FabianBruengerDedalus2
Copy link

Hi @mjhenkes,
this is not working. But i found finally a workaround even for the 9.2.0:

chmod -R 777 /github/home

If you have tests which are creating folders you probably will run into the same kind of issues. Then also give full permissions to the target folders.

@mmahalwy
Copy link

mmahalwy commented Feb 1, 2022

@FabianBruengerDedalus2 where did you run that? example?

@ohueter
Copy link

ohueter commented Feb 4, 2022

Can you try the work around mentioned here: cypress-io/github-action#446 (comment)

configuring the job to run as a non root user.

That worked for me using the cypress/browsers:node16.5.0-chrome94-ff93 image, thank you!

@FabianBruengerDedalus2
Copy link

@FabianBruengerDedalus2 where did you run that? example?

example_step:
    name: Example
    runs-on: [self-hosted]
    container:
      image: cypress/included:9.2.0

    steps:
      # Init
      - name: Checkout project
        uses: actions/checkout@v2

      # This workaround is required for running npm install and cypress because of some kind of bug in the new cypress included images (or might be the node version!)
      - name: Set permissions
        run: |
          chmod -R 777 /github/home
          chmod -R 777 cypress
          
      # Start the actual cypress tests
      - name: Run Tests
        uses: cypress-io/github-action@v2
        timeout-minutes: 120
        with:
          install: false
          command: npm run cy:chrome

@humoyun91
Copy link

humoyun91 commented May 10, 2022

I had the same issue and tried above mentioned solutions but did not work for me. By adding CYPRESS_CACHE_FOLDER and defining non-root user options: --user 1001 I managed to pass this issue:

cypress-tests:
  runs-on: ubuntu-latest
  container:
    image: cypress/included:9.5.4
    options: --user 1001 # setting this user is also important
  steps:
    - name: checkout
      uses: actions/checkout@v3

    - name: cache node modules
      uses: actions/cache@v3
      with:
        path: ~/.npm
        key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
        restore-keys: |
          ${{ runner.os }}-build-${{ env.cache-name }}-
          ${{ runner.os }}-build-
          ${{ runner.os }}-

    - name: Cypress run
      id: cy-e2e-tests
      uses: cypress-io/github-action@v2
      env:
        CYPRESS_CACHE_FOLDER: '${GITHUB_WORKSPACE}/.cypress-cache' # this line fixed the problem
        GITHUB_TOKEN: ${{ secrets.COMPANY_TOKEN }}
        REACT_APP_DEPLOYMENT_PHASE: development

@Dottenpixel
Copy link

I'm using a playwright image and landed here googling the error message
> options: --user 1001 did the trick for me! Thx @humoyun91 !!

@gkatsanos
Copy link

gkatsanos commented Aug 10, 2023

None of the proposed workarounds work.

  1. options: --user 1001
- name: Reclaim cache directory
   run: chown -R 1001:1001 /github/home/.cache && echo "pwn dat cache"

using a self-hosted runner (simple linux instance ) and tried all images from node 16.x and above..

@MikeMcC399
Copy link
Collaborator

Closing this issue, as Cypress GitHub Actions now documents

Include options: --user 1001 to avoid permissions issues.

The issue from @gkatsanos #560 (comment) appears to have a separate root cause as recent tests showed that GitHub-hosted runners had no problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants