Closed Pauwelz closed 1 year ago
Usually, when registering services, asynchronous code is not recommended. That is also why we introduced synchronous secret retrieval for the secret store. Could you check if this works for GetRawSecret
instead?
With GetRawSecret it works as expected indeed. If it's not recommended to to things async during registration then I guess we will switch in our code.
If we use GetRawSecretAsync during the execution of the function, to retrieve the secret, then it works fine as well.
With GetRawSecret it works as expected indeed.
Ok, that's great! 🥳 Glad we could be of assistance. Thx for contacting, using Arcus, and promoting it, means a lot 😉.
If it's not recommended to to things async during registration then I guess we will switch in our code.
Something that Microsoft's dependency container is not really build for (unlike StructureMap, for example). So, I would indeed recommend using synchronous stuff there.
If we use GetRawSecretAsync during the execution of the function, to retrieve the secret, then it works fine as well.
Yes, in those cases, it is really 'async all the way', I guess.
I'll close this, @Pauwelz, as there is a solution found for this. Don't hesitate to re-open this or create a new issue if there is anything else you want to discus. Until then 🫡
Describe the bug When using the GetRawSecretAsync on a secret stored in KeyVault to get a API Key for a Named HTTP Client, the code continues without waiting for the response.
To Reproduce
Expected behavior That the secret gets retrieved correctly like it does with a config file.
Additional context Using GetRawSecretAsync on a secret stored in config file or environment works correctly as we can see with the BaseUri
Switching to GetRawSecret also works fine (although taking 15 seconds)
Using Arcus.Security 1.9.0 with .Net 6 and Functions v4 (Isolated)