在服务器上声明弹弓会导致应用程序崩溃

时间:2016-02-12 10:01:27

标签: meteor-slingshot

在客户端我有:

'change #banner_input': function(){
    event.preventDefault();
    var uploader = new Slingshot.Upload("myFileUploads");
    Slingshot.fileRestrictions("myFileUploads", {
        allowedFileTypes: ["image/png", "image/jpeg", "image/gif"],
        maxSize: 10 * 1024 * 1024 // 10 MB (use null for unlimited).
    });
    var fileO = event.target.files[0];
    console.log(fileO);
    uploader.send(fileO, function (error, downloadUrl) {
        if (error) {
            // Log service detailed response.
            console.error('Error uploading', uploader.xhr.response);
        }
        else {
         alert(downloadUrl);
           // Meteor.users.update(Meteor.userId(), {$push: {"profile.files": downloadUrl}});
        }
    });

}

但是当我将它添加到服务器时,即使是“空”进行调试,应用程序也会崩溃:

Slingshot.createDirective("myFileUploads", Slingshot.S3Storage, {

  });

我得到的错误:

应用程序数据\ Local.meteor \包\流星工具\ 1.1.10 \ MT-os.windows.x86_32 \ dev_bundle \服务器-LIB \ node_modules \纤维\ future.js:245 W20160212-11:50:43.857(2)? (STDERR)throw(ex); W20160212-11:50:43.857(2)? (STDERR)^ W20160212-11:50:43.858(2)? (STDERR)错误:匹配错误:失败匹配。字段区域中的验证 W20160212-11:50:43.858(2)? (STDERR)检查(包/ check / match.js:33:1) W20160212-11:50:43.858(2)? (STDERR)新的Slingshot.Directive(packages / edgee_slingshot / packages / edgee_slingshot.js:304:1) W20160212-11:50:43.858(2)? (STDERR)at Object.Slingshot.createDirective(packages / edgee_slingshot / packages / edgee_slingshot.js:274:1) W20160212-11:50:43.858(2)? (STDERR)在server / slingshot.js:5:1 W20160212-11:50:43.859(2)? (STDERR)在server / slingshot.js:23:1 W20160212-11:50:43.859(2)? (STDERR)在somepath.meteor \ local \ build \ programs \ server \ boot.js:242:10 W20160212-11:50:43.859(2)? (STDERR)在Array.forEach(本机) W20160212-11:50:43.859(2)? (STDERR)在函数。 .each。 .forEach(somepath.meteor \ packages \ meteor-tool \ 1.1.10 \ mt-os.windows.x86_32 \ dev_bundle \ server-lib \ node _modules \下划线\ underscore.js:79:11) W20160212-11:50:43.860(2)? (STDERR)在path.meteor \ local \ build \ programs \ server \ boot.js:137:5

感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

错误:匹配错误:匹配失败。字段区域中的验证

Region会导致错误。

请阅读以下地区代码:http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region

尝试从您的属性中更改它。