question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Azure Storage Blob v12.10.0 - "Azure.RequestFailedException: The condition specified using HTTP conditional header(s) is not met." exception while trying to download blobs.

See original GitHub issue

We currently use Azure Storage Blob v12.10.0 which we recently migrated to. And now, we are transiently hitting Azure.RequestFailedExceptions while trying to download blobs.

Code:

                try
		{
			StorageTransferOptions options = new StorageTransferOptions
			{
				// Set the maximum number of workers that
				// may be used in a parallel transfer.
				MaximumConcurrency = this.parallelOperationThreadCount
			};
			await blob.DownloadToAsync(stream, new BlobRequestConditions(), options, cancellationToken).ConfigureAwait(false);
			tracer.Succeeded = true;
		}
		catch (Exception e)
		{
			this.eventLogger.LogWarning($"Failed to download with exception:{e}");
			throw;
		}

Error Detials:

Azure.RequestFailedException: The condition specified using HTTP conditional header(s) is not met. RequestId:ab1be42c-501e-0007-740d-5cc588000000 Time:2022-04-29T21:07:00.1407329Z Status: 412 (The condition specified using HTTP conditional header(s) is not met.) ErrorCode: ConditionNotMet Content: <?xml version="1.0" encoding="utf-8"?><Error>ConditionNotMet<Message>The condition specified using HTTP conditional header(s) is not met. RequestId:ab1be42c-501e-0007-740d-5cc588000000 Time:2022-04-29T21:07:00.1407329Z</Message></Error> Headers: x-ms-request-id: ab1be42c-501e-0007-740d-5cc588000000 x-ms-client-request-id: eae8ba9d-fe6f-4c4e-8526-2233250ce9c3 x-ms-version: 2020-10-02 x-ms-error-code: ConditionNotMet Date: Fri, 29 Apr 2022 21:06:59 GMT Server: Windows-Azure-Blob/1.0,Microsoft-HTTPAPI/2.0 Content-Length: 252 Content-Type: application/xml at Azure.Storage.Blobs.BlobRestClient.

Questions:

Note: We are currently not adding any Request Conditions but still throws the conditional header(s) is not met error.

  1. Found this solution while browsing for a fix: link. Would you recommend this fix for Azure Storage Blob v12.10.0 as well?
  2. If we make ifMatch=*, what is the effect on DownloadToAsync operation? And in the scenario where we are updating while trying to download the same blob, what is the effect on both the operations?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:18 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
anandnaracommented, Jul 7, 2022

Fixed this by setting IfMatch = ETag.All as part of BlobRequestConditions. This is an optimistic approach as per the link. The assumption here is that, setting a property field such as IfMatch does not affect the blob contents and does not interrupt DownloadToAsync operation. Also, according to this link, a blob either does not exist or exist with the entire content that was put including metadata.

Code Changes:

try
{
	StorageTransferOptions options = new StorageTransferOptions
	{
		// Set the maximum number of workers that
		// may be used in a parallel transfer.
		MaximumConcurrency = this.parallelOperationThreadCount
	};
	
	BlobRequestConditions blobRequestConditions = new BlobRequestConditions
	{
		IfMatch = ETag.All
	};

	await blob.DownloadToAsync(stream, blobRequestConditions, options, cancellationToken).ConfigureAwait(false);
	tracer.Succeeded = true;
}
catch (Exception e)
{
	this.eventLogger.LogWarning($"Failed to download with exception:{e}");
	throw;
}
1reaction
SatishBoddu-MSFTcommented, May 18, 2022

Hello @anandnara We have routed this issue to the Service Team’s attention for further action, thanks for the detailed information!

Read more comments on GitHub >

github_iconTop Results From Across the Web

conditional header is not met error - How to ignore ETag ...
I read blob content from Azure blob storage. ... bottom (Status: 412 - The condition specified using HTTP conditional header(s) is not met), ......
Read more >
Azure Blob: "The condition specified using HTTP ...
Azure Blob : "The condition specified using HTTP conditional header(s) is not met" ... I got this exception when I run my application....
Read more >
Azure Storage Blob Service - Apache Camel
The Azure Storage Blob component is used for storing and retrieving blobs from Azure Storage Blob Service using Azure APIs v12. However in...
Read more >
Azure.Storage.Blobs 12.17.0
This client library enables working with the Microsoft Azure Storage Blob service for storing binary and text data. For this release see notes...
Read more >
Developing Cloud Applications with Windows Azure Storage
Conditional operations. It is often desirable to perform an operation on data only when particular conditions can be satisfied.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found