logicapps icon indicating copy to clipboard operation
logicapps copied to clipboard

Logic App queue trigger (In-App) not firing when connections.json contains the connectionString value

Open ppanchal-mobiz opened this issue 10 months ago • 1 comments

Describe the Bug

When the connections.json file contains the connectionString value instead of the appsetting reference, the following error is logged in the Host log file. The error says validation and creation failed but that Azure portal saves it successfully and the workflow is not triggered instead.

Workflow Error: operationName='WorkflowFunctionDefinitionProvider.ProcessWorkflow', message='Workflow 'queue-trigger-temp' validation and creation failed. Error: 'The template validation failed: 'The provided value 'DefaultEndpointsProtocol=https;AccountName=<redacted>;AccountKey=<redacted>;EndpointSuffix=core.windows.net' is not template language expression. (Parameter 'expression')'.'', exception='Microsoft.Azure.Workflows.Common.ErrorResponses.ErrorResponseMessageException: The template validation failed: 'The provided value 'DefaultEndpointsProtocol=https;AccountName=<redacted>;AccountKey=<redacted>;EndpointSuffix=core.windows.net' is not template language expression. (Parameter 'expression')'.
 ---> System.ArgumentException: The provided value 'DefaultEndpointsProtocol=https;AccountName=<redacted>;AccountKey=<redacted>;EndpointSuffix=core.windows.net' is not template language expression. (Parameter 'expression')
   at Microsoft.Azure.Workflows.Templates.Parsers.TemplateExpressionParser.ParseTemplateLanguageExpression(String expression)
   at Microsoft.Azure.Workflows.Data.Engines.ServiceProviderEngine.ValidateAndGetAppSettingFromConnection(String connectionName, String triggerType, String connection)
   at Microsoft.Azure.Workflows.Data.Engines.ServiceProviderEngine.GetConnectionAndSetConfigurationIfNeeded(IServiceOperationsProvider serviceProvider, InsensitiveDictionary`1 connectionParameterValues, InsensitiveDictionary`1 resolvedConnectionParameterValues, String connectionName, String triggerType, IConfiguration configuration)
   at Microsoft.Azure.Workflows.Data.Engines.ServiceProviderEngine.GetFunctionBindingData(FlowTemplateTrigger trigger, String workflowName, String triggerName, FlowPropertiesDefinition flowDefinition, IConfiguration configuration)
   at Microsoft.Azure.Workflows.WebJobs.Extensions.Initialization.WorkflowFunctionDefinitionProvider.GetWorkFlowMetadata(String workFlowName, FlowPropertiesDefinition flowDefinition)
   at Microsoft.Azure.Workflows.WebJobs.Extensions.Initialization.WorkflowFunctionDefinitionProvider.<>c__DisplayClass76_0.<<ProcessWorkflow>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.Azure.Workflows.Templates.Engines.TemplateEngine.HandleTemplateException[T](Func`1 protectedMethod, HttpStatusCode statusCode)
   --- End of inner exception stack trace ---
   at Microsoft.Azure.Workflows.Templates.Engines.TemplateEngine.HandleTemplateException[T](Func`1 protectedMethod, HttpStatusCode statusCode)
   at Microsoft.Azure.Workflows.WebJobs.Extensions.Initialization.WorkflowFunctionDefinitionProvider.ProcessWorkflow(FlowFunction flowFunction, ConcurrentDictionary`2 flowsProcessed)', extensionVersion='1.66.8.0', siteName='app-euno-prod-architect-app-la', slotName='Production', activityId='70e7a2ae-d905-4597-922a-2569493da0b3'.

erroneous connections.json file:

{
    "serviceProviderConnections": {
        "azurequeues": {
            "displayName": "architectapplasa",
            "parameterSetName": "connectionString",
            "parameterValues": {
                "connectionString": "DefaultEndpointsProtocol=https;AccountName=<redacted>;AccountKey=<redacted>;EndpointSuffix=core.windows.net"
            },
            "serviceProvider": {
                "id": "/serviceProviders/azurequeues"
            }
        }
    }
}

fix required for workflow to trigger:

{
    "serviceProviderConnections": {
        "azurequeues": {
            "displayName": "architectapplasa",
            "parameterSetName": "connectionString",
            "parameterValues": {
                "connectionString": "@appsetting('azurequeues_connectionString')"
            },
            "serviceProvider": {
                "id": "/serviceProviders/azurequeues"
            }
        }
    }
}

Plan Type

Standard

Steps to Reproduce the Bug or Issue

  1. Create a new stateful workflow in Logic App Standard using the Azure portal
  2. Select When messages are available in a queue as the trigger
  3. Create a new queue connection using Storage account connection string as the Authentication Type
  4. Provide the Storage Account Connection String
  5. Save the workflow and ensure the connection string value provided in step-4 is stored in connections.json file.
  6. Put a message in the queue and check if the workflow is triggered.

Workflow JSON

{
    "definition": {
        "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
        "actions": {
            "Parse_JSON": {
                "inputs": {
                    "content": "@triggerBody()?['messageText']",
                    "schema": {
                        "properties": {
                            "Id": {
                                "type": "integer"
                            }
                        },
                        "type": "object"
                    }
                },
                "runAfter": {},
                "type": "ParseJson"
            }
        },
        "contentVersion": "1.0.0.0",
        "outputs": {},
        "triggers": {
            "When_messages_are_available_in_a_queue": {
                "inputs": {
                    "parameters": {
                        "queueName": "testqueue"
                    },
                    "serviceProviderConfiguration": {
                        "connectionName": "azurequeues",
                        "operationId": "receiveQueueMessages",
                        "serviceProviderId": "/serviceProviders/azurequeues"
                    }
                },
                "type": "ServiceProvider"
            }
        }
    },
    "kind": "Stateful"
}

Screenshots or Videos

No response

Additional context

No response

AB#27630250

ppanchal-mobiz avatar Apr 12 '24 14:04 ppanchal-mobiz