Azure / azure-sdk-for-js

This repository is for active development of the Azure SDK for JavaScript (NodeJS & Browser). For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/javascript/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-js.
MIT License
1.98k stars 1.15k forks source link

Unable to append create blob from local file post deployment to Azure #4179

Closed 839998664 closed 4 years ago

839998664 commented 5 years ago

I am using azure-storage apis to store uploaded files from application to azure storage account. The code works locally but post deployment to Azure it stops working. The code in question is below:

let r = [];
    var form = formidable.IncomingForm();
    form.parse(req, function (error, fields, files) {
        if(error) { console.log(error); res.json(error); }

        for (var key in files) {
            var oldpath = files[key].path;
            console.log(oldpath);
            blobService.createAppendBlobFromLocalFile('zygos-images', files[key].name, oldpath, function (err, result) {
                if (err) {
                    console.log(err);
                    res.json(err);
                } else {
                    console.log(result);
                    r.push(result);
                }
            });
        }
    });
    res.json(r);

The above code correctly adds the files to Azure Storage. But once deployed to azure it fails to do so, There is no error message, in fact it returns a URL to the file in storage which does not work. Since there is no indication( error message) as to what went wrong unable to figure it out.

XiaoningLiu commented 5 years ago

I cannot give suggestions as there is no error message or context. If you can print the error message from createAppendBlobFromLocalFile callback, that will be great