dotnet-sdk
dotnet-sdk copied to clipboard
GetStateAsync throws exception if key not found when using json contentType
Ask your question here
I am using redis
for state store component with RedisJSON
module, and when getting state with contentType
metadata set to application/json
, method GetStateAsync
on the dapr client throws the following exception if the key doesn't exist:
Error when trying to Retrieve ... with Id: ..."Error","@x":"Dapr.DaprException:
State operation failed: the Dapr endpoint indicated a failure. See InnerException for details.
Grpc.Core.RpcException: Status(StatusCode=\"Internal\", Detail=\"fail to get <...> from state store local: redis: nil\")
at Dapr.Client.DaprClientGrpc.GetStateAsync[TValue](String storeName, String key, Nullable`1 consistencyMode, IReadOnlyDictionary`2 metadata, CancellationToken cancellationToken)
Is this an intended behavior or more like a bug? When not using any metadata the return value from GetStateAsync
is null
with no exception thrown if the key doesn't exist.
Thanks!