···
const uploadResult = await uniCloud.uploadFile({
cloudPath: "redis_backup.json",
fileContent: fs.createReadStream(backupFilePath)
});
···

- 发布:2023-09-22 21:17
- 更新:2023-09-27 11:07
- 阅读:330
产品分类: uniCloud/App
操作步骤:
预期结果:
成功上传到云存储
成功上传到云存储
实际结果:
参数校验错误: Invalid options.filePath
Error: 参数校验错误: Invalid options.filePath
at E (/code/index.js:20:17924)
at uploadFile (/code/index.js:198:429643)
at (/tmp/function/@dcloudio/serverless/lib/aliyun/uni-cloud.js:1:5648)
at backupRedis (/tmp/function/index.obj.js:33:38)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
参数校验错误: Invalid options.filePath
Error: 参数校验错误: Invalid options.filePath
at E (/code/index.js:20:17924)
at uploadFile (/code/index.js:198:429643)
at (/tmp/function/@dcloudio/serverless/lib/aliyun/uni-cloud.js:1:5648)
at backupRedis (/tmp/function/index.obj.js:33:38)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at doBackup (/tmp/function/index.obj.js:45:2)
at test (/tmp/function/index.obj.js:62:3)
at Q (/tmp/function/index.js:1:24237)
at z (/tmp/function/index.js:1:25321)
at runUserFunction (/code/index.js:98:229649)
参数校验错误: Invalid options.filePath
Error: 参数校验错误: Invalid options.filePath
at E (/code/index.js:20:17924)
at uploadFile (/code/index.js:198:429643)
at (/tmp/function/@dcloudio/serverless/lib/aliyun/uni-cloud.js:1:5648)
at backupRedis (/tmp/function/index.obj.js:33:38)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
参数校验错误: Invalid options.filePath
Error: 参数校验错误: Invalid options.filePath
at E (/code/index.js:20:17924)
at uploadFile (/code/index.js:198:429643)
at (/tmp/function/@dcloudio/serverless/lib/aliyun/uni-cloud.js:1:5648)
at backupRedis (/tmp/function/index.obj.js:33:38)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at doBackup (/tmp/function/index.obj.js:45:2)
at test (/tmp/function/index.obj.js:62:3)
at Q (/tmp/function/index.js:1:24237)
at z (/tmp/function/index.js:1:25321)
at runUserFunction (/code/index.js:98:229649)
bug描述:
根据文档
云端运行uniCloud.uploadFile参数只需要cloudPath和fileContent,但报filePath参数缺失
Error: 参数校验错误: Invalid options.filePath
如果把fileContent改成filePath(HBuilder中代码提示也是filePath)
则报错Error: 参数校验错误: filePath和fileBuffer不能都为空
怀疑端uniCloud.uploadFile按照前端逻辑运行。
我不确定这是否是软件本身的问题,还是我的使用方法不当。云对象代码附后,恳请查阅
liife
我用的buffer也是不行,我发帖了请回复。。。。
2024-02-24 12:45