IdempotentAPI with dotnet 6 and FusionCache not sending back cached data
MohamadTahir opened this issue · 4 comments
Hello, so I am using IdempotentAPI with .net 6 and FusionCache with Redis, I went through your documentation and the fusionCache documentation I got everything up and running.
I can see that the has access and is storing my data on my Redis database, I set up Redis-commander and I can clearly see the data in Redis.
when I call my endpoint I get back data new data every time altho I am providing it with the same IdempotencyKey
info: IdempotentAPI.Core.Idempotency[0] IdempotencyFilterAttribute [Before Controller execution]: Request for POST: [/v1/roles/test]() received (50 bytes) IdempotentAPI.Core.Idempotency: Information: IdempotencyFilterAttribute [Before Controller execution]: Request for POST: [/v1/roles/test]() received (50 bytes) info: IdempotentAPI.Core.Idempotency[0] IdempotencyFilterAttribute [Before Controller]: Return result from idempotency cache (of type Microsoft.AspNetCore.Mvc.ObjectResult) IdempotentAPI.Core.Idempotency: Information: IdempotencyFilterAttribute [Before Controller]: Return result from idempotency cache (of type Microsoft.AspNetCore.Mvc.ObjectResult) info: IdempotentAPI.Core.Idempotency[0] IdempotencyFilterAttribute [Before Controller]: End IdempotentAPI.Core.Idempotency: Information: IdempotencyFilterAttribute [Before Controller]: End info: IdempotentAPI.Core.Idempotency[0] IdempotencyFilterAttribute [Before Controller execution]: Request for POST: [/v1/roles/test]() received (50 bytes) IdempotentAPI.Core.Idempotency: Information: IdempotencyFilterAttribute [Before Controller execution]: Request for POST: [/v1/roles/test]() received (50 bytes) info: IdempotentAPI.Core.Idempotency[0] IdempotencyFilterAttribute [Before Controller]: Return result from idempotency cache (of type Microsoft.AspNetCore.Mvc.ObjectResult) IdempotentAPI.Core.Idempotency: Information: IdempotencyFilterAttribute [Before Controller]: Return result from idempotency cache (of type Microsoft.AspNetCore.Mvc.ObjectResult) info: IdempotentAPI.Core.Idempotency[0] IdempotencyFilterAttribute [Before Controller]: End
let me know if I'm doing anything wrong, or if you require more logs/information.
So after more digging up and testing, it turns out that you actually need to return an "ActionResult" of your object not return the object directly.
The documentation does not mention that it is required to return an ActionResult of the object. I am not sure if this is an intended thing or it is just a result of the rest of my configurations. @RichardGreen-IS2 @ikyriak can you please confirm?
Hello @MohamadTahir,
Thanks for taking the time to report and investigate this issue!
This was a bug, and now it is fixed 😄. Can you please try the latest version (v1.0.1) of the IdempotentAPI NuGet package to confirm that everything is working for you?
Hey @ikyriak I am very sorry for the late reply.
give me a day or two to test the new version and I will get back to you :) thank you.
I am closing this issue based on the committed fix.
However, feel free to reopen if the problem still exists.
Thank you 😄