banco-alimentar / alimentestaideia.pt

Site doações alimente esta ideia
http://alimentestaideia.pt
Other
10 stars 0 forks source link

Azure blob Error in GetInvoice RequestFailedException: The specified blob already exists. #757

Closed tiagonmas closed 9 months ago

tiagonmas commented 10 months ago

Paid a donation and clicked on Get Invoice and received the exception https://dev.alimentestaideia.pt/Identity/Account/Manage/GenerateInvoice?publicDonationId=bbc8285b-92b7-4924-998d-a720f177b9fa

The Create blob lacks error handling.

An unhandled exception occurred while processing the request.
RequestFailedException: The specified blob already exists.
RequestId:b2a794e6-501e-0054-0687-02d261000000
Time:2023-10-19T12:29:41.8806706Z
Status: 409 (The specified blob already exists.)
ErrorCode: BlobAlreadyExists

Content:
<?xml version="1.0" encoding="utf-8"?><Error><Code>BlobAlreadyExists</Code><Message>The specified blob already exists.
RequestId:b2a794e6-501e-0054-0687-02d261000000
Time:2023-10-19T12:29:41.8806706Z</Message></Error>

Headers:
Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-request-id: b2a794e6-501e-0054-0687-02d261000000
x-ms-client-request-id: fd337995-3806-4f00-bc2a-a6d016928cc8
x-ms-version: 2023-08-03
x-ms-error-code: BlobAlreadyExists
Date: Thu, 19 Oct 2023 12:29:41 GMT
Content-Length: 220
Content-Type: application/xml
tiagonmas commented 10 months ago

This happened 2 times already, and it seems like a "racing condition". While I asked for the invoice via UI, the backend must have already received the payment notification and had created the invoice in the meantime.

guerrerotook commented 9 months ago

Added code to check again if the file exits at the moment of upload again. This will prevent this issue.

guerrerotook commented 9 months ago

This is related to #764 so I'm closing this one.