关于数据库备份上传七牛云失败问题
来源:9-6 上传数据库备份到七牛私有云
James_dai
2017-09-03
我这边也遇到了问题,
我的文件名叫task
1、在movie.backup.sh 文件中:
NODE_ENV=$backUpFolder@$backFileName node /home/leek_manager/task/upload.js
2、执行:sh movie.backup.sh
3、tar包文件已经生成:movie_2017_09_03_1654.tar.gz
4、但是后面执行报错如下:
/home/leek_manager/task/node_modules/qiniu/qiniu/storage/rs.js:659
throw new Error('invalid putpolicy options');
^
Error: invalid putpolicy options
at new PutPolicy (/home/leek_manager/task/node_modules/qiniu/qiniu/storage/rs.js:659:11)
at uptoken (/home/leek_manager/task/upload.js:15:19)
at Object.<anonymous> (/home/leek_manager/task/upload.js:19:9)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
4回答
-
ochai
2017-09-20
我也遇到这个错误,请问一下你解决了吗?
222017-09-20 -
ehuo0123
2017-11-01
var qiniu = require("qiniu");
var accessKey = '你的accesskey';
var secretKey = '你的secrestkey';
var mac = new qiniu.auth.digest.Mac(accessKey, secretKey);
var bucket = '存储空间的名称';
var options = {
scope: bucket,
};
var putPolicy = new qiniu.rs.PutPolicy(options);
var uploadToken=putPolicy.uploadToken(mac);
var config = new qiniu.conf.Config();
//不同的区域,取值不同,华东为z0
config.zone = qiniu.zone.Zone_z0;
var parts = process.env.NODE_ENV.split('@');
var key = parts[1] + '.tar.gz';
var localFile = parts[0] + '/' + key;
var formUploader = new qiniu.form_up.FormUploader(config);
var putExtra = new qiniu.form_up.PutExtra();
formUploader.putFile(uploadToken, key, localFile, putExtra, function(respErr,
respBody, respInfo) {
if (respErr) {
throw respErr;
}
if (respInfo.statusCode == 200) {
console.log(respBody);
} else {
console.log(respInfo.statusCode);
console.log(respBody);
}
});
10 -
二位取根
2018-10-06
如图所示,亲测成功
00 -
Scott
2017-09-04
七牛抽风了,到七牛的官方文档,参照他们最新的 SDK 用法来试下吧,七牛 SDK 升级,貌似不向下兼容
00
相似问题