Skip to content
This repository has been archived by the owner on Mar 22, 2018. It is now read-only.

Precondition Failed (412) when reading from blob #166

Closed
dsarfati opened this issue Mar 15, 2018 · 3 comments
Closed

Precondition Failed (412) when reading from blob #166

dsarfati opened this issue Mar 15, 2018 · 3 comments
Assignees
Labels

Comments

@dsarfati
Copy link

I am getting a pre-condition failed when trying to read an image from blob.

Here is how I save the images to blob.

Here is the code to get the image out.

var blob = container.GetBlockBlobReference(imagePath);

var stream = await blob.OpenReadAsync();

The exception is thrown when I try and read the stream. This is the log for the single read event.

PUT /devstoreaccount1/app-icons?restype=container 409 0.549 ms - 146
HEAD /devstoreaccount1/app-icons/6204a98b-661a-4945-a09b-8d2d01035489.jpg 200 0.399 ms - 91880
GET /devstoreaccount1/app-icons/6204a98b-661a-4945-a09b-8d2d01035489.jpg 412 0.650 ms - 187

I looked into the azurite code and found where the headers are being checked:

if ((ifMatchVal !== undefined && !ifMatch) ||
(ifUnmodifiedSinceVal !== undefined && !ifUnmodifiedSince)) {
throw new AError(ErrorCodes.ConditionNotMetWrite); // 412
}

I'm not sure which conditional headers are being populated since I'm not specifying anything. It might be possible that the default C# client has some preconditions?

@arafato
Copy link
Owner

arafato commented Mar 15, 2018

@dsarfati confirmed, fixed, and released as v2.5.1. Same issue (etag was not enclosed in double parenthesis). Let me know if it works for you.

@arafato arafato self-assigned this Mar 15, 2018
@arafato arafato added the bug label Mar 15, 2018
@dsarfati
Copy link
Author

@arafato Great! Did you see my comment on #165 regarding etag format?

@arafato
Copy link
Owner

arafato commented Mar 16, 2018

@dsarfati yes, just answered. :-)

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

No branches or pull requests

2 participants