首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >cos.putObject,传了key还是报错 Error: missing param Key ?

cos.putObject,传了key还是报错 Error: missing param Key ?

提问于 2023-10-31 15:43:03
回答 1关注 0查看 174
代码语言:js
复制
const COS = require('cos-nodejs-sdk-v5');

const config = {
    SecretId: 'xxx',
    SecretKey: 'xxx',
};

const cos = new COS(config);

cos.putObject({
    Bucket: 'xxx',
    Region: 'xxx',
    key: '/private3.0/dist.zip',
    FilePath: './dist.zip',
    onProgress(progressData) {
        console.log(JSON.stringify(progressData));
    },
    onFileFinish(err, data, options) {
        console.log(`${options.Key}上传${err ? '失败' : '完成'}`);
    },
}, (err, data) => {
    console.log(err || data);
});

执行报错: { code: 'Error', name: 'Error', message: 'missing param Key' }

回答

和开发者交流更多问题细节吧,去 写回答
相关文章

相似问题

相关问答用户
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档