Closed AlexMasson closed 3 months ago
hi @AlexMasson , can you please let us know how did you create this function app and what command did you use to create?
Hi @raorugan, here is a zip file containing :
The bicep file was deployed using this CLI command :
az deployment group create --resource-group xxx --template-file function-aca.bicep
I didn't create a Log Analytics Workspace for this example, but you'll have to if you want to get this trace in system logs of the container app :
error parsing azure service bus metadata: no connection setting given
This exemple display a function app which never scale down, because the scaling rule is not working.
Thanks for all the details, @AlexMasson. Can you please try wrapping the Connection setting name in double percent signs (%%) and let us know if scaling works as expected?
[ServiceBusTrigger("%ImagoSdk:ServiceBus:Topics:InternalBigData%", Connection = "%ImagoSdk:ServiceBus:ConnectionString%", IsSessionsEnabled = true)]
Hello @krishnajaju , thank you for your response.
I tried this solution:
The Azure Function is no longer working at all because the ConnectionString value of the ServiceBusTrigger attribute must not be set inside double percent signs, according to the official documentation. The error when I tried to debug with it:
The listener for function 'XXX' was unable to start. Microsoft.Azure.WebJobs.Extensions.ServiceBus: Service Bus account connection string 'Endpoint=sb://XXX.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=XXX' does not exist. Make sure that it is a defined App Setting.
The scaling rule is also not working. With this solution, the value of the scaling rule parameter "connectionFromEnv" is replaced by the value of the connection string. This value must be the name of the environment variable containing the connection string, according to the Keda documentation.
Thanks for trying it out @AlexMasson and apologies it did not resolve the issue. We have identified a bug in our system, and we will work on fixing this soon. As a temporary work-around, I would suggest having two app settings for service bus connection string, one with delimiter :
and another with delimiter __
pointing to the same ServiceBus connection string, until we fix this issue. Please let me know if this workaround helps. We will let you know once fix for this issue is rolled out.
Ok thank you @krishnajaju I will do that. Keep me informed.
Hello @krishnajaju , this work-around is unfortunately not working, I have this kind of error during the deployment :
Env variable name 'xx:xx:xx' contains invalid character, regex used for validation is '^[-._a-zA-Z][-._a-zA-Z0-9]*$'
Thanks for trying it out @AlexMasson. We are currently working on fixing this bug, and we will update you once the fix is rolled out. Until then, can you please reference app settings for Connection
attribute without any hierarchy (without any :
or __
)?
Hi @AlexMasson, the bug has been fixed and the update has been rolled out. Please let us know if you encounter any further issues.
Which trigger/binding are you using?
Which language are you using? C#
Expected behavior The scaling rule must work.
Actual behavior I have an Azure Function with a ServiceBusTrigger. The trigger is configured according to the documentation, with environment variables containing the ":" character in the name to hierarchize the app settings.
[ServiceBusTrigger("%ImagoSdk:ServiceBus:Topics:InternalBigData%", Connection = "ImagoSdk:ServiceBus:ConnectionString", IsSessionsEnabled = true)]
The app settings are registered as environment variables in the Azure Function using "__" instead of ":" for Linux compatibility.
When the function is deployed in an Azure Function on Container App, the scaling rule uses the app settings name with ":", thus it doesn't work.
Additionally, when a scaling rule does not work, the ContainerApp remains up 24/7, which can be problematic if unnoticed, as it prevents stopping, starting, or restarting the Azure Function.
To Reproduce
Logs Here are some SystemLogs from the ContainerApp