Azure / logicapps

Azure Logic Apps labs, samples, and tools
MIT License
363 stars 301 forks source link

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

Closed ppanchal-mobiz closed 3 months ago

ppanchal-mobiz commented 5 months ago

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 commented 5 months ago

Adding to this, I also noticed that my connections.json file automatically replaces my appsetting references with full connection string values when I change some other action's connection!

github-actions[bot] commented 4 months ago

This issue is stale because it has been open for 45 days with no activity.

github-actions[bot] commented 3 months ago

This issue was closed because it has been inactive for 14 days since being marked as stale.