Avi A
Avi A

Reputation: 323

Declaring slingshot on the server causes app to crash

On the client I have:

'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}});
        }
    });

}

But when I add this to the server ,even "empty" for debugging, app crashes:

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

  });

The error I get:

AppData\Local.meteor\packages\meteor-tool\1.1.10\mt-os.windows.x86_32\dev_bundle\server-lib\node_modules\fibers\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) Error: Match error: Failed Match.Where validation in field region W20160212-11:50:43.858(2)? (STDERR) at check (packages/check/match.js:33:1) W20160212-11:50:43.858(2)? (STDERR) at new 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) at server/slingshot.js:5:1 W20160212-11:50:43.859(2)? (STDERR) at server/slingshot.js:23:1 W20160212-11:50:43.859(2)? (STDERR) at somepath.meteor\local\build\programs\server\boot.js:242:10 W20160212-11:50:43.859(2)? (STDERR) at Array.forEach (native) W20160212-11:50:43.859(2)? (STDERR) at Function..each..forEach (somepath.meteor\packages\meteor-tool\1.1.10\mt-os.windows.x86_32\dev_bundle\server-lib\node _modules\underscore\underscore.js:79:11) W20160212-11:50:43.860(2)? (STDERR) at path.meteor\local\build\programs\server\boot.js:137:5

Thanks for your help.

Upvotes: 2

Views: 180

Answers (1)

mngkvn
mngkvn

Reputation: 1

Error: Match error: Failed Match.Where validation in field region

Region causes the error.

Read this for region codes : http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region

And try changing it from your properties.

Upvotes: 0

Related Questions