Closed petrkasnal closed 1 month ago
@petrkasnal - we have a lot of work to do in order to enable Azure Functions + Aspire. There will need to be changes both in Aspire and in Azure Functions.
See https://github.com/dotnet/aspire/issues/920 as well.
cc @captainsafia
@petrkasnal Yep -- as @eerhardt mentioned there's some subtleties to sort out with the way that the Azure Functions host and worker consume connection strings so some additional work is required to make WithReference
work correctly with Azure Functions.
Out of curiousity: can you share what types of resources you are trying to inject into your worker? Are you just trying to get things working with the Azure Storage instance that the host needs or are you trying to consume Azure Service Bus/Event Hubs/some other resource type?
@eerhardt @captainsafia Thank you for response. I understand that getting Aspire ready for Azure Functions takes a lot of time. That's why I just made this solution for now. But I don't understand why it wouldn't work. I only pass Azure Functions the connection strings and that's it. It looks to me like it's asynchronous code that sometimes manages to execute and sometimes doesn't. I would need to solve this to be able to use them, or is there another solution currently possible?
I'm trying to consume different services not just storage. For example Service Bus, database etc.
Is there an existing issue for this?
Describe the bug
Hi I use Aspire and find it to be a super tool. I've only encountered one problem. Unfortunately there is no option to add Azure Function in Aspire. I have made the following extension method that triggers the Azure Function.
It works pretty well, but I have to manually run the debug no big deal. However, there is one slightly incomprehensible problem. I'm using WithReference to pass connection strings to the Azure Function. However, what happens is that not all connection strings are correct. Sometimes they are taken from Azure Function from local.settings instead of Aspire.
Aspire connection strings:
Function connection strings:
When you start Aspire and debug the Azure function application, the strangest situation occurs. Once a variable is set by local.settings. Once none or once all. Debug breakpoint is inside scope.
I have attached the repository where an example is given. https://github.com/petrkasnal/ExampleOfAzureFunction
Thanks
Expected Behavior
I expect loaded all environemntes settings from Aspire.
Steps To Reproduce
Exceptions (if any)
No response
.NET Version info
.NET 8.0 dontet-isolated
Anything else?
No response