收藏
回答

云函数 fs.openSync permission denied ?

let privateKey = fs.readFileSync('./apiclient_key.pem').toString('ascii');

云函数里,本地调试没有任何问题,上传后远端调试就报下面的错,我到服务端看文件都传上去了啊,应该是上面这句读取私钥文件报错

Error: EACCES: permission denied, open './apiclient_key.pem'

at Object.fs.openSync (fs.js:646:18)

at Object.fs.readFileSync (fs.js:551:33)

at app.router (/var/user/index.js:505:27)

at dispatch (/var/user/node_modules/tcb-router/src/index.js:167:40)

at /var/user/node_modules/tcb-router/src/index.js:142:16

at Promise (/var/user/node_modules/tcb-router/src/index.js:106:17)

at new Promise (<anonymous>)

at TcbRouter.serve (/var/user/node_modules/tcb-router/src/index.js:105:20)

at EventHandler.exports.main [as realHandler] (/var/user/index.js:529:14)

at EventHandler.handle (/var/runtime/node8/bootstrap.js:402:28)

at invoke (/var/runtime/node8/bootstrap.js:205:22)

at Timeout.setTimeout [as _onTimeout] (/var/runtime/node8/bootstrap.js:137:9)

at ontimeout (timers.js:475:11)

at tryOnTimeout (timers.js:310:5)

at Timer.listOnTimeout (timers.js:270:5)



回答关注问题邀请回答
收藏

3 个回答

登录 后发表内容
问题标签