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

ERR Profile save() exception: Error: EACCES: permission denied, open '/bot/demo.wechaty.json' #982

Closed
charlesluo2014 opened this issue Nov 22, 2017 · 8 comments
Labels

Comments

@charlesluo2014
Copy link

Provide Your Network Information

  1. Where is the location of your server? (i.e. City, or In/Out China)
  2. Which cloud platform(AliYun/Qcloud/DigitalOcean/etc) are you using?

Run npm run doctor or wechaty run doctor(for docker user), paste output here

wechaty run doctor

Expected behavior

success

Actual behavior

13:45:16 ERR Profile save() exception: Error: EACCES: permission denied, open '/bot/demo.wechaty.json'
(node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: EACCES: permission denied, open '/bot/demo.wechaty.json'
(node:30) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
^C13:45:19 INFO Bot finis(130, SIGINT)

Steps to reproduce the behavior (and fixes, if any)

Full Output Logs

$ WECHATY_LOG=silly npm run ts-node mybot.ts

# or 

$ WECHATY_LOG=silly node dist/mybot.js
Show Logs ### Paste the full output logs here with `WECHATY_LOG=silly` set
# PASTE FULL LOG OUTPUT AT HERE:


@huan
Copy link
Member

huan commented Nov 22, 2017

The error message is clear enough: Error: EACCES: permission denied, which means you have not right to write file to directory /bot

@huan huan closed this as completed Nov 22, 2017
@Gcaufy
Copy link
Contributor

Gcaufy commented Nov 30, 2017

Container changed to run as a bot user.
https://github.com/Chatie/wechaty/blob/master/Dockerfile#L52-L64

When docker bind-mount, it doesn't touch the permission of the directory mounted in. so bot user do not have the permission for that directory, that's why you have this error.
Try to run the following commnad to change the permission for your directory, it will work.

sudo chown 999.999 `pwd`

@huan huan reopened this Nov 30, 2017
@huan huan added the bug label Nov 30, 2017
@huan
Copy link
Member

huan commented Nov 30, 2017

Thanks @Gcaufy

Confirmed, will look into it to see if we should go back to use root user as before.

@WeiFei365
Copy link

WeiFei365 commented Dec 13, 2017

@zixia did you fixed this exception? when i try to save the user's avatar, the docker will exit. thanks a lot

Error: EACCES: permission denied, open '/bot/dfgdsg.jpg'

@huan
Copy link
Member

huan commented Dec 13, 2017

Not fix yet, because I'm still thinking about why I change to non-root user before...

It seems we should restore the docker to use the root user to make the life easier.

@Gcaufy
Copy link
Contributor

Gcaufy commented Dec 13, 2017

I agree, docker container they are independent, root should be safe for your host machine.

@huan
Copy link
Member

huan commented Dec 13, 2017

@Gcaufy Ok, let's change it back to use root user.

Is there anyone who wants to make this PR? :)

WeiFei365 added a commit to WeiFei365/wechaty that referenced this issue Dec 14, 2017
@huan
Copy link
Member

huan commented Feb 21, 2018

Will close this issue because I believe we had already switch back to use root inside our docker containers.

@huan huan closed this as completed Feb 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants