Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blob upload fails with 400 error code quite randomly #82

Open
dorszpw opened this issue May 10, 2018 · 0 comments
Open

Blob upload fails with 400 error code quite randomly #82

dorszpw opened this issue May 10, 2018 · 0 comments

Comments

@dorszpw
Copy link

dorszpw commented May 10, 2018

Sometimes (reported by a customer) when sending pictures (SDK 0.2.4) with below code, we get the 400 error (InvalidBlockList) also listed below.
It seems quite random, I couldn't really reproduce this error, and customer also can retry successfully.
But this makes the whole transmission to fail, so it's not good.
I couldn't find any solution to retry such failing request either (at least not for iOS SDK).

Is there some solution for this? How to retry on such failing request? It should be possible, since manual retry is OK.

func uploadFileToBlob(container: String = Config.photosContainer, viewController: UIViewController, uuid: String, pictureSection: String, fileName: String, data: Data, completion: @escaping ((String?) -> Void)) {
        
        if let _ = self.account {
            let blobClient = self.account?.getBlobClient()
            
            let blobContainer = blobClient?.containerReference(fromName: container)
            let blobDirectory = blobContainer?.directoryReference(fromName: String(format: "%@/%@", uuid, pictureSection))
            let blockBlob = blobDirectory?.blockBlobReference(fromName: fileName)
            
            let options = blobClient?.defaultRequestOptions
            options?.maximumExecutionTime = 30
            blockBlob?.upload(from: data, accessCondition: nil, requestOptions: options, operationContext: nil, completionHandler: {(error: Error?) -> Void in
                
                if let _ = error {
                    completion(error.debugDescription)
                } else {
                    completion(nil)
                }
            })
        }
    }

Error sending picture for vehicle chassis 123456. Section/picture: 4/3. Error description: Optional(Error Domain=com.Microsoft.AzureStorage.ErrorDomain Code=3 "(null)" UserInfo={HTTP Status Code=400, rawErrorData=<CFData 0x170d3c10 [0x382267d8]>{length = 221, capacity = 221, bytes = 0xefbbbf3c3f786d6c2076657273696f6e ... 3c2f4572726f723e}, URLResponse=<NSHTTPURLResponse: 0x17288510> { URL: https://volvovikingqa.blob.core.windows.net/photos/path/1?comp=blocklist } { status code: 400, headers {
"Content-Length" = 221;
"Content-Type" = "application/xml";
Date = "Thu, 10 May 2018 12:13:37 GMT";
Server = "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0";
"x-ms-request-id" = "a5f337c1-e01e-0015-5058-e89493000000";
"x-ms-version" = "2015-04-05";
} }, OperationContext=<AZSOperationContext: 0x171acd30>, Code=InvalidBlockList, AdditionalErrorDetails={
}, RequestResult=<AZSRequestResult: 0x17228300>, Message=The specified block list is invalid.
RequestId:a5f337c1-e01e-0015-5058-e89493000000
Time:2018-05-10T12:13:37.6086268Z})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant