Any working implementations of the azure-blob-upload package out there?
I’m working a project with a requirement to send large (video) file uploads to an Azure storage container. I thought it would be an easy-peasy using jamesfebin’s package, but I can’t get it to work. Wondering if there’s something obvious I’m missing. Don’t know if it’s more of a Meteor implementation issue or an Azure issue.
I get this vague error on the response from Azure.
Error: One of the request inputs is out of range.
RequestId:a4b21fe1-0001-0032-6677-71c3e6000000
Time:2015-04-07T21:09:07.9330207Z
To reproduce, you have to have Azure storage container of course. Add the azure-blob-upload package to your /packages folder with git so you can modify the package code (git clone https://github.com/jamesfebin/azure-blob-upload.git). Then, on line 329 of azureupload.js, add a console.log(err) to log out the Azure error response to your terminal.
Here’s some code to do a test upload:
// client/upload.html
<template name="uploadVideo">
<div class="panel panel-default">
<div class="panel-heading">
<h3>Upload Video</h3>
</div>
<div class="panel-body">
<form class="form-group">
<input type="file" id="uploadFile" class="uploadFile" />
</form>
</div>
</div>
</template>
// client/upload.js
Template.uploadVideo.events({
'change .uploadFile': function(event,template){
var files = event.target.files;
var file = files[0];
AzureFile.upload(
file,"uploadFile",
{},
function(error,success){
if (error) console.log(error);
else console.log(success);
}
);
}
})
// server/methods.js
Meteor.methods({
'uploadFile': function(file) {
var response;
if (file === void 0) {
throw new Meteor.Error(500, "Missing File", "", "");
}
response = file.azureUpload(file.name, "YouAzureStorageAccount", "EnterYourAzureStorageKey", "EnterYourContainerName");
return console.log(response: '+response);
}
})
// sample values from what I’m passing in on
blobService: [object Object]
blockId: QmxvY2tObzE0
container: invidiad
fileName: minions.mp4
stream: [object Object]:
stream.size(): 220262
After Googling the error message, I referenced https://msdn.microsoft.com/en-us/library/dd135715.aspx to see if I could figure out which of these values might be illegal and causing the error, but it mainly addresses the name of the blob and each blob needing a unique name if it’s in the same container. I think I’ve eliminated those two possibilities.
For reference, here’s the NodeJS SDK documentation on creating blocks from streams: https://www.omniref.com/js/npm/azure-storage/0.3.2/symbols/BlobService%23createPageBlobFromStream
Alternatively, if someone is aware of another way to send blobs to Azure from Meteor, then I’m all ears. I was initially hoping to skip sending the file through the Meteor server by using the Slingshot package, but looking at the Azure documentation, I can’t figure out how to adapt the NodeJS SDK documentation to Slingshot. I’ve noted that in the past month, there has been some discussion on the scarcity of documentation for figuring out how to implement Azure into Slingshot https://gitter.im/CulturalMe/meteor-slingshotabout.