2***@qq.com
2***@qq.com
  • 发布:2025-03-31 21:30
  • 更新:2025-04-01 16:04
  • 阅读:68

在微信小程序开发工具中调用云函数上传文件到七牛云扩展存储时,调用uploadFile会报错Error: Parameter sk is required

分类:uniCloud

在微信小程序开发工具中调用云函数上传文件到七牛云扩展存储时,调用uploadFile会报错 Error: Parameter sk is required。 到七牛云官网找到sk和ak,以及在DCloud后台里面开发者参数的bucketName,加到在uniCloud.getExtStorageManager中,又会报错 errCode: 631, errMsg: 'no such bucket' ,换成DClound后台里面开发者参数的bucketSecret,又会报错:uploadResult: { errCode: 401, errMsg: 'bad token'
请问大神们,这种情况,应该怎么调用uploadFile上传到扩展存储?

云函数如下

const extStorageManager = uniCloud.getExtStorageManager({  
    provider: "qiniu",  
    domain: "example.com", // 域名地址  
});  
const { fileName, fileContent, openid } = body;  
const cloudPath = `Avatar/${openid}_${fileName}`;  
const uploadResult = await extStorageManager.uploadFile({  
        cloudPath:cloudPath,  
        fileContent: Buffer.from(fileContent, 'base64'),  
        allowUpdate: false,  
    });  
console.log('uploadFile: ', res);
2025-03-31 21:30 负责人:无 分享
已邀请:
DCloud_uniCloud_VK

DCloud_uniCloud_VK

相同帖子:https://ask.dcloud.net.cn/question/207563?item_id=295767&rf=false

要回复问题请先登录注册