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

Created on 22 Nov 2017  路  8Comments  路  Source: wechaty/wechaty

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:



bug

Most helpful comment

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

All 8 comments

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

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`

Thanks @Gcaufy

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

@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'

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.

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

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

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

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

Was this page helpful?
0 / 5 - 0 ratings