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

Azure Storage component doesn't work with Azure Storage RunAsEmulator #5078

Closed
eerhardt opened this issue Jul 25, 2024 · 4 comments · Fixed by #5084
Closed

Azure Storage component doesn't work with Azure Storage RunAsEmulator #5078

eerhardt opened this issue Jul 25, 2024 · 4 comments · Fixed by #5084
Labels
area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication

Comments

@eerhardt
Copy link
Member

Repro Steps

In your AppHost:

var builder = DistributedApplication.CreateBuilder(args);

var blobs = builder.AddAzureStorage("Storage")
    // Use the Azurite storage emulator for local development
    .RunAsEmulator()
    .AddBlobs("BlobConnection");

builder.AddProject<Projects.AspireApp21_Web>("webfrontend")
    .WithExternalHttpEndpoints()
    .WithReference(blobs);

In your webfrontend project:

var builder = WebApplication.CreateBuilder(args);

// Add service defaults & Aspire components.
builder.AddServiceDefaults();

// add this line
builder.AddAzureBlobClient("BlobConnection");

F5

hit the webfrontend/health endpoint

Expected results

Healthy

Actual results

Unhealthy

Logs

      client assembly: Azure.Storage.Blobs
2024-07-25T12:37:42.5405046 warn: Azure.Core[8]
      Error response [ab557070-d043-4751-975d-10a24ee30e85] 400 The API version 2024-08-04 is not supported by Azurite. Please upgrade Azurite to latest version and retry. If you are using Azurite in Visual Studio, please check you have installed latest Visual Studio patch. Azurite command line parameter "--skipApiVersionCheck" or Visual Studio Code configuration "Skip Api Version Check" can skip this error.  (00.0s)
      Server:Azurite-Blob/3.30.0
      x-ms-error-code:InvalidHeaderValue
      x-ms-request-id:d221c3a6-dc25-4191-ab4f-0da95f77d798
      Date:Thu, 25 Jul 2024 17:37:42 GMT
      Connection:keep-alive
      Keep-Alive:REDACTED
      Transfer-Encoding:chunked
      Content-Type:application/xml
      
2024-07-25T12:37:42.5596003 fail: Microsoft.Extensions.Diagnostics.HealthChecks.DefaultHealthCheckService[103]
      Health check Azure_BlobServiceClient with status Unhealthy completed after 69.5226ms with message '(null)'
      Azure.RequestFailedException: The API version 2024-08-04 is not supported by Azurite. Please upgrade Azurite to latest version and retry. If you are using Azurite in Visual Studio, please check you have installed latest Visual Studio patch. Azurite command line parameter "--skipApiVersionCheck" or Visual Studio Code configuration "Skip Api Version Check" can skip this error. 
RequestId:d221c3a6-dc25-4191-ab4f-0da95f77d798
Time:2024-07-25T17:37:42.527Z
      Status: 400 (The API version 2024-08-04 is not supported by Azurite. Please upgrade Azurite to latest version and retry. If you are using Azurite in Visual Studio, please check you have installed latest Visual Studio patch. Azurite command line parameter "--skipApiVersionCheck" or Visual Studio Code configuration "Skip Api Version Check" can skip this error. )
      ErrorCode: InvalidHeaderValue

If we update to image tag 3.31.0 here, the problem goes away:

.WithAnnotation(new ContainerImageAnnotation
{
Registry = "mcr.microsoft.com",
Image = "azure-storage/azurite",
Tag = "3.30.0"
});

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-integrations Issues pertaining to Aspire Integrations packages label Jul 25, 2024
@eerhardt eerhardt added area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication and removed area-integrations Issues pertaining to Aspire Integrations packages labels Jul 25, 2024
@eerhardt
Copy link
Member Author

eerhardt commented Jul 25, 2024

I think this is an issue we would service for in an ideal world.

Workaround is to use:

var blobs = builder.AddAzureStorage("Storage")
    // Use the Azurite storage emulator for local development
    .RunAsEmulator(emulator => emulator.WithImageTag("3.31.0"))
    .AddBlobs("BlobConnection");

cc @mitchdenny @joperezr @sebastienros @radical

@radical
Copy link
Member

radical commented Jul 25, 2024

We hit this earlier too - #4646 !

@eerhardt
Copy link
Member Author

We hit this earlier too - #4646 !

We need a test here, if it broke us twice.

@joperezr
Copy link
Member

Great find. I agree that we should have a test for this. Is the fix essentially to bump the tag to the new version then? If so we can just do that and ship next month, and folks hitting this can use your workaround.

radical added a commit to radical/aspire that referenced this issue Jul 26, 2024
radical added a commit that referenced this issue Jul 26, 2024
* [tests] Add AzureStorageEmulatorFunctionalTests

* Bump azurite from 3.30.0 to 3.31.0

Issue: #5078

* Address PR feedback

---------

Co-authored-by: Eric Erhardt <[email protected]>
radical added a commit to radical/aspire that referenced this issue Jul 30, 2024
commit c680699
Merge: 9e48bf0 8b603ea
Author: Ankit Jain <[email protected]>
Date:   Fri Jul 26 18:14:38 2024 -0400

    Merge remote-tracking branch 'origin/main' into playground-tests-prep

commit 9e48bf0
Author: Ankit Jain <[email protected]>
Date:   Fri Jul 26 18:14:29 2024 -0400

    Fix up import conditions

commit b1726a2
Author: Ankit Jain <[email protected]>
Date:   Fri Jul 26 17:54:59 2024 -0400

    Update Aspire.sln to track the project name changes

commit 8b603ea
Author: Ankit Jain <[email protected]>
Date:   Fri Jul 26 14:57:19 2024 -0400

    Fix Azure Storage `RunAsEmulator` (dotnet#5084)

    * [tests] Add AzureStorageEmulatorFunctionalTests

    * Bump azurite from 3.30.0 to 3.31.0

    Issue: dotnet#5078

    * Address PR feedback

    ---------

    Co-authored-by: Eric Erhardt <[email protected]>

commit bc27dba
Author: Ankit Jain <[email protected]>
Date:   Thu Jul 25 18:20:53 2024 -0400

    [playground] Update all ProjectReferences to AspireProjectOrPackageReference. And skip Dashboard.csproj when building for testing

commit 13a1550
Author: Ankit Jain <[email protected]>
Date:   Thu Jul 25 17:26:42 2024 -0400

    [playground] Add top level Directory.Build.{props,targets}

    And use Aspire.RepoTesting.* to allow testing and this replaces the
    per-project sdk imports.

commit 6d84aee
Author: Ankit Jain <[email protected]>
Date:   Thu Jul 25 17:31:49 2024 -0400

    [playground] Rename AppHost projects to be named consistently

    .. with `.AppHost` suffix. `Aspire.Hosting.Testing` specifically looks
    for a `.AppHost` suffix to identify apphost assemblies.

commit 2a2e2b9
Author: Ankit Jain <[email protected]>
Date:   Thu Jul 25 17:27:06 2024 -0400

    [playground] remove all the per-project Directory.Build.{props,targets}

# Conflicts:
#	playground/Directory.Build.props
#	playground/Directory.Build.targets
#	playground/dapr/AppHost/DaprAppHost.csproj
#	playground/dapr/AppHost/Program.cs
#	playground/dapr/AppHost/Properties/launchSettings.json
#	playground/dapr/AppHost/aspire-manifest.json
#	playground/dapr/Dapr.AppHost/Dapr.AppHost.csproj
#	playground/dapr/Dapr.AppHost/Program.cs
#	playground/dapr/Dapr.AppHost/Properties/launchSettings.json
#	playground/dapr/Dapr.AppHost/appsettings.json
#	playground/dapr/Dapr.AppHost/aspire-manifest.json
#	playground/dapr/dapr.AppHost/Dapr.AppHost.csproj
#	playground/dapr/dapr.AppHost/Program.cs
#	playground/dapr/dapr.AppHost/Properties/launchSettings.json
#	playground/dapr/dapr.AppHost/appsettings.json
#	playground/dapr/dapr.AppHost/aspire-manifest.json
#	playground/orleans/OrleansAppHost/appsettings.json
@github-actions github-actions bot locked and limited conversation to collaborators Aug 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants