本地调试可以正常返回云函数结果内容,关闭云函数本地调试之后云函数报错,上传部署云函数所有文件,为啥?
[图片] 云函数: const cloud = require('wx-server-sdk');
const translate = require('@vitalets/google-translate-api');
cloud.init({
env: "wechat-online-a4c8d5",
traceUser: true
})
// 云函数入口函数
exports.main = async (event, context) => {
return await translate(event.translateContent, {
from: event.from,
to: event.to,
tld: 'cn',
client: 'gtx'
});
}
客户端调用: const data = this.getTranslatData();
let _this = this;
wx.cloud.callFunction({
name: 'translate',
data: data,
success: res => {
console.log('[云函数] [translate] call success: ', res.result);
_this.setData({
translateResult: res.result.text,
isTranslated: true,
isLoading: false
})
},
fail: err => {
console.error('[云函数] [translate] 调用失败', err)
_this.setData({
translateResult: null,
isTranslated: false,
isLoading: false
})
}
});
关闭云函数之后调用结果:
VM125:1
[云函数] [translate] 调用失败 Error: errCode: -404011 cloud function execution error | errMsg: cloud.callFunction:fail requestID 3c719654-7161-11ea-ab05-525400192d0e, cloud function service error code -504002, error message EROFS: read-only file system, mkdir '/home/qcloud'; at cloud.callFunction api;
at new u (WAService.js:1)
at d (WAService.js:1)
at f (WAService.js:1)
at Function.success (WAService.js:1)
at WAService.js:1
at C (WAService.js:1)
at i.<anonymous> (WAService.js:1)
at i.emit (WAService.js:1)
at Rs (WAService.js:1)
at WAService.js:1
请问这是啥原因导致的呢,开发者工具是最新的版本了