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

Aspire default table HealthCheck fails with 400 bad request #2450

Open
onionhammer opened this issue Aug 9, 2024 · 5 comments
Open

Aspire default table HealthCheck fails with 400 bad request #2450

onionhammer opened this issue Aug 9, 2024 · 5 comments
Assignees
Labels
docker table-storage Relating to Azurite table storage implementation

Comments

@onionhammer
Copy link

onionhammer commented Aug 9, 2024

Which service(blob, file, queue, table) does this issue concern?

Table

Which version of the Azurite was used?

3.31.0

Where do you get Azurite? (npm, DockerHub, NuGet, Visual Studio Code Extension)

DockerHub

What's the Node.js version?

NA -- Came w/ docker image

What problem was encountered?

{Azure.RequestFailedException: The query condition specified in the request is invalid.
RequestId:c4e94892-fb90-4649-82d3-9598e3e6200a
Time:2024-08-09T14:10:35.536Z
Status: 400 (Bad Request)
ErrorCode: InvalidInput

Content:
{"odata.error":{"code":"InvalidInput","message":{"lang":"en-US","value":"The query condition specified in the request is invalid.\nRequestId:c4e94892-fb90-4649-82d3-9598e3e6200a\nTime:2024-08-09T14:10:35.536Z"}}}

Headers:
Server: Azurite-Table/3.31.0
x-ms-error-code: REDACTED
x-ms-request-id: c4e94892-fb90-4649-82d3-9598e3e6200a
x-ms-version: REDACTED
Date: Fri, 09 Aug 2024 14:10:35 GMT
Connection: keep-alive
Keep-Alive: REDACTED
Transfer-Encoding: chunked
Content-Type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8

at Azure.Data.Tables.TableRestClient.QueryAsync(String nextTableName, QueryOptions queryOptions, CancellationToken cancellationToken)
at Azure.Data.Tables.TableServiceClient.<>c__DisplayClass34_0.<b__0>d.MoveNext()
-...

More stack:

" at Azure.Data.Tables.TableRestClient.d__8.MoveNext()\r\n at Azure.Data.Tables.TableServiceClient.<>c__DisplayClass34_0.<b__0>d.MoveNext()\r\n at Azure.Core.PageableHelpers.FuncAsyncPageable1.<AsPages>d__4.MoveNext()\r\n at Azure.Core.PageableHelpers.FuncAsyncPageable1.d__4.System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult(Int16 token)\r\n at Azure.AsyncPageable1.<GetAsyncEnumerator>d__6.MoveNext()\r\n at Azure.AsyncPageable1.d__6.MoveNext()\r\n at Azure.AsyncPageable`1.d__6.System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult(Int16 token)\r\n at HealthChecks.Azure.Data.Tables.AzureTableServiceHealthCheck.d__3.MoveNext()"

Health check source code:

https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/blob/master/src/HealthChecks.Azure.Data.Tables/AzureTableServiceHealthCheck.cs

Steps to reproduce the issue?

After switching to Azurite, using the default health checker that comes with the Aspire component for adding azure table storage, the health check is receiving a 400 bad request.

  1. Create a new Aspire app
  2. Add azurite to apphost
// Add Azure Storage
var storage = builder.AddAzureStorage("storage")
    .RunAsEmulator(c => c.WithImageTag("3.31.0").WithDataVolume();
);
var yourComponent = storage.AddTables("yourcomponent");
  1. Add a client app which loads the component, then enable health checks
builder.AddKeyedAzureTableClient("yourcomponent");

Have you found a mitigation/solution?

Not yet

@onionhammer onionhammer changed the title HealthCheck fails with 400 bad request Aspire default table HealthCheck fails with 400 bad request Aug 9, 2024
@onionhammer
Copy link
Author

FYI This is still happening with .NET 9, latest aspire

@blueww blueww added table-storage Relating to Azurite table storage implementation docker labels Nov 15, 2024
@blueww
Copy link
Member

blueww commented Nov 15, 2024

@EmmaZhu
Would you please help to look?

@onionhammer
Would you please share the Azurite debug log to help investigation?

@onionhammer
Copy link
Author

This is the only relevant log the container spits out:

2024-11-15T08:24:11 172.17.0.1 - - [15/Nov/2024:14:24:11 +0000] "GET /devstoreaccount1/Tables?$format=application%2Fjson%3Bodata%3Dminimalmetadata&$filter=false HTTP/1.1" 400 -

@causer
Copy link

causer commented Nov 15, 2024

I have the same issue. Looks like this call from in health check class causes the exception:
await _tableServiceClient .QueryAsync(filter: "false", cancellationToken: cancellationToken)

Health check source code:

https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/blob/master/src/HealthChecks.Azure.Data.Tables/AzureTableServiceHealthCheck.cs

So, azurite don't like such query filter.

@causer
Copy link

causer commented Nov 15, 2024

The workaround is to disable built-in health check:

builder.AddAzureTableClient("connectionname", settings => settings.DisableHealthChecks = true);

and add your own health check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker table-storage Relating to Azurite table storage implementation
Projects
None yet
Development

No branches or pull requests

4 participants