1
votes

I have Cloud Convert converting videos, and when it completes, I tell Azure BLOB Storage to download the file from it's the conversion output URL, using the method CloudBlockBlob.StartCopyAsync.

I must say, this used to work. I haven't changed a single line of code until this process started to fail.

Now, anytime Azure tries to download from Cloud Convert, it fails with the message 500 InternalServerError "Copy failed.". If I copy the download the URL in the browser, it downloads the file normally. The process works with the Storage Emulator.

My question is, is anyone else having the same problem? How do I fix this? Do I need to download the file and upload it to Azure Blob Storage myself?

2
Can you trace the request/response through a tool like Fiddler? May be share a URL that we can try? - Gaurav Mantri
@GauravMantri The Azure Storage is a service. I don't have access to the server. I could do it with the emulator, but the emulator works. I can send you an URL of the file I'm trying to download, but it appears that any output URL from cloud convert would have the same result. - Vinicius Melquiades
Can you send me the URL? I will try to simulate the same. - Gaurav Mantri
@GauravMantri host123d1qj.cloudconvert.com/download/… It also works with HTTP - Vinicius Melquiades
I was able to perform the copy operation successfully however I noticed the file size of the blob is 0 bytes. Upon further inspection I found that the link you shared has Content-Disposition property set. Can you try by removing the Content-Disposition property value on the source file? - Gaurav Mantri

2 Answers

0
votes

But once I check the CopyState it says it failed with the message InternalServerError "Copy failed."

During testing on my side, I didn't encounter this error. Please try to debug your code and capture the detailed error to see whether this error is thrown in your code or the server-side.

I must say, this used to work. I haven't changed a single line of code until this process started to fail.

According to your description, I registered an account in Cloud Convert and converted a .pdf file to .docx file. Then I tested it on my side and got the same result as Gaurav said that the blob could be created successfully however the size of the blob is 0 bytes. I assumed that Cloud Convert might make some adjustments. Since you could download the file in the browser, then you could follow the code below to achieve your purpose as an alternative approach.

//pdf-to-docx.docx
url = "https://host123d1qm.cloudconvert.com/download/~7-9EyBedLQQyCoh41ONW6h1RpFY";
using (HttpClient client = new HttpClient())
{   
    //download the file via the URL provided by CloudConvert
    var response = await client.GetAsync(url);
    //define the block blob object
    string filename = response.Content.Headers.ContentDisposition.FileName.Trim(new char[] { '"' });
    string contentType = response.Content.Headers.ContentType.ToString();
    CloudBlockBlob blockBlob = container.GetBlockBlobReference(filename);
    blockBlob.Properties.ContentType = contentType;
    //upload blob
    await blockBlob.UploadFromStreamAsync(await response.Content.ReadAsStreamAsync());
}
0
votes

Have you looked into using the Azure Storage Data Movement Library: Git Docs. Specifically, see TransferManager.CopyAsync(). Another thing to look into is changing the access type on the destination container.