You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use ExecuteStateTransactionAsync() with Azure Cosmos DB state store, but it does not work. I keep getting "error while executing state transaction: transaction failed due to operation 0 which failed with status code 400" exception.
I tried exactly what is in the Dapr documentation in .NET here:
var random = new Random();
int orderId = random.Next(1, 1000);
var requests = new List<StateTransactionRequest>()
{
new("order_1", JsonSerializer.SerializeToUtf8Bytes(orderId.ToString()), StateOperationType.Upsert)
};
await _daprClient.ExecuteStateTransactionAsync(STORE_NAME, requests, cancellationToken: cancellation);
@koumdev Did the PoserShell approach work, or did it return the same 400 error? If the latter, then that would point to a possible issue with the runtime or component rather than the .NET SDK. In that case, I might ask the question in the dapr/components-contrib repo which would be more familiar with Azure Cosmos DB.
@philliphoff thank you for your reply and sorry for posting in the wrong place. Yes, I get the same 400 error with PowerShell. I posted in the components repo here.
Ask your question here
Hello,
I'm trying to use ExecuteStateTransactionAsync() with Azure Cosmos DB state store, but it does not work. I keep getting
"error while executing state transaction: transaction failed due to operation 0 which failed with status code 400"
exception.I tried exactly what is in the Dapr documentation in .NET here:
I also tried it with PowerShell:
Invoke-RestMethod -Method Post -ContentType 'application/json' -Body '{"operations": [{"operation":"upsert", "request": {"key": "order_1", "value": "250"}}, {"operation":"upsert", "request": {"key": "order_2", "value": "450"}}]}' -Uri 'http://localhost:3500/v1.0/state/statestorecosmos/transaction'
The documentation says that Azure Cosmos DB state store supports transactional operations.
What am I doing wrong?
Thanks!
The text was updated successfully, but these errors were encountered: