Azure-Functions icon indicating copy to clipboard operation
Azure-Functions copied to clipboard

Microsoft.Azure.WebJobs.Extensions.Storage version 5.1.2 and Azure Functions v. 4.2.0, error: "The specified container already exists", status 409

Open MarGraz opened this issue 1 year ago • 5 comments

I'm using .net 6 and Azure Function v. 4, and I get the error: "The specified container already exists", status 409.

Those are the dependencies in my project:

    <PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.2.2" />
    <PackageReference Include="Azure.Identity" Version="1.8.2" />
    <PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="5.1.2" />
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.2.0" />

The exception seems to be called by:

BlobContainerClient.CreateIfNotExists ---> BlobContainerClient.Create

it seems to happen in my implementation when I use:

await blobContainerClient.CreateIfNotExistsAsync(PublicAccessType.BlobContainer);

I see this error in Azure Application Insights:

Azure.RequestFailedException: The specified container already exists.
RequestId:7aadc04c-601e-0051-2726-7fab43000000
Time:2023-05-05T07:54:33.5483399Z
Status: 409 (The specified container already exists.)
ErrorCode: ContainerAlreadyExists

Content:
<?xml version="1.0" encoding="utf-8"?><Error><Code>ContainerAlreadyExists</Code><Message>The specified container already exists.
RequestId:7aadc04c-601e-0051-2726-7fab43000000
Time:2023-05-05T07:54:33.5483399Z</Message></Error>

Headers:
Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-request-id: 7aadc04c-601e-0051-2726-7fab43000000
x-ms-client-request-id: 45bb8263-7256-4297-9f81-12c74c6ecb1d
x-ms-version: 2022-11-02
x-ms-error-code: ContainerAlreadyExists
Date: Fri, 05 May 2023 07:54:32 GMT
Content-Length: 230
Content-Type: application/xml

   at Azure.Storage.Blobs.ContainerRestClient.Create(Nullable`1 timeout, IDictionary`2 metadata, Nullable`1 access, String defaultEncryptionScope, Nullable`1 preventEncryptionScopeOverride, CancellationToken cancellationToken)
   at Azure.Storage.Blobs.BlobContainerClient.CreateInternal(PublicAccessType publicAccessType, IDictionary`2 metadata, BlobContainerEncryptionScopeOptions encryptionScopeOptions, Boolean async, CancellationToken cancellationToken, String operationName)

Do you know if it is available a fix?

Thank you

Originally posted by @MarGraz in https://github.com/Azure/Azure-Functions/issues/2166#issuecomment-1536138042

MarGraz avatar May 05 '23 11:05 MarGraz