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

[Bug?]: rw can't generate anything - Reverted because: EACCES: permission denied, scandir #7690

Closed
1 task
bnn1 opened this issue Feb 27, 2023 · 2 comments
Closed
1 task
Labels
bug/needs-info More information is needed for reproduction

Comments

@bnn1
Copy link
Contributor

bnn1 commented Feb 27, 2023

What's not working?

When I generate a new page, or a new anything, I’m getting this error: “Reverted because: EACCES: permission denied, scandir”.

The new page (or the new anything) is not generated as a result.

It happens because redwood is trying to scan a directory that it doesn't have permission to read. Such a directory can be created as a result of mapping a docker volume to file system.

How do we reproduce the bug?

  1. In a rw project root create a new directory and set permission to 000 mkdir dir && sudo chmod 000 dir
  2. Run any rw g command, for example yarn rw g page mypage

In my exact case the directory is created by Postgres docker container

  1. In rw project root run the command
docker run -d \
  --name postgres \
  -e POSTGRES_PASSWORD=your_password \
  -v $(pwd)/db:/var/lib/postgresql/data \
  -p 5432:5432 \
  postgres:latest
  1. Run any rw g command, for example yarn rw g page mypage

What's your environment? (If it applies)

System:
    OS: Linux 6.1 undefined
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 18.14.2 - /tmp/xfs-5a61aa00/node
    Yarn: 3.4.1 - /tmp/xfs-5a61aa00/yarn
  Databases:
    SQLite: 3.41.0 - /usr/bin/sqlite3
  npmPackages:
    @redwoodjs/auth-supabase-setup: 4.2.0 => 4.2.0 
    @redwoodjs/core: 4.2.0 => 4.2.0

Are you interested in working on this?

  • I'm interested in working on this
@bnn1 bnn1 added the bug/needs-info More information is needed for reproduction label Feb 27, 2023
@bnn1
Copy link
Contributor Author

bnn1 commented Feb 27, 2023

I found a working workaround is to use acl:

sudo setfacl -m u:USERGROUP:rwX /path/to/folder

This way it won't mess up with permissions and I'm able to generate rw stuff and use database normally.

@Josh-Walker-GM
Copy link
Collaborator

Hey @bnn1, thanks for the issue and the fix!

This seems to boil down to the restriction that the redwood CLI expects to be able to access all of the contents in the project, so it's breaking when you have a folder that only root can access. I don't think that this expectation of the CLI is unreasonable?

I think we would advice anyone else who runs into this issue to follow your permission fix or to have the other docker volumes (which may then raise permission issues) outside the project directory.

Thanks again for documenting the behaviour and workaround. I'm going to close this issue but feel free to reopen if you want to or if you have a suggested way forward we might not have thought about.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/needs-info More information is needed for reproduction
Projects
None yet
Development

No branches or pull requests

2 participants