Azure / LogicAppsUX

https://learn.microsoft.com/azure/logic-apps
MIT License
75 stars 81 forks source link

Workflow when deployed to different location from VSCode will run into new connection creation issue #2679

Closed vgouth closed 1 year ago

vgouth commented 1 year ago

Describe the Bug

Getting invalid connection error for Office_365 connection after deploying the workflow from VS code. There is automatically change in location as per Workflow Json . Selected location in Vs code to create a logic app is East US. But in portal automatically Central US location is getting added as per Workflow JSON code. Added Workflow JSON code od VS code and portal in Workflow JSON tab. Tried to add a new connection for deployed logic app in portal but it is not allowing to add the new connection as the location is different. Attached the screenshot for the same .

Plan Type

Standard

Steps to Reproduce the Bug or Issue

  1. Create a new Logic App Project
  2. Add a workflow to your local project
  3. Open the workflow.json file in designer and author a new workflow a. Add http request Trigger b. Add a compose action here with custom text c. Add a ServiceBus action. From the add new paramter dropdown add content and add random text in JSON format like {"a":"b"} d. Add a send email action with the body being the output of the compose action (step b) e. Add a new connection to your email action f. Add http response action
  4. Press F5 to build and run your project
  5. Run the workflow a. Open overview page. Right + Click on workflow.json file and "Overview" b. Copy call back URL from the overview page c. Send the http request POST via Postman and wait for the response
  6. Refresh the overview page and your should see your local run
  7. Open the monitoring view for your run from the overview page
  8. Verify the run details and action inputs and output
  9. Create a logic app and Deploy to Azure 10.After deployment is success, Open the deployed logic app in portal.
  10. Open the workflow in designer .
  11. Workflow should not show any error.

Expected:Workflow should not show any error. Actual: Getting invalid connection error for Office_365 connection after deploying the workflow from VS code

Workflow JSON

Portal Workflow JSON:

{
  "definition": {
    "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
    "actions": {
      "Response": {
        "type": "Response",
        "kind": "Http",
        "inputs": {
          "statusCode": 200
        },
        "runAfter": {
          "Send_an_email_(V2)": [
            "SUCCEEDED"
          ]
        }
      },
      "Compose": {
        "type": "Compose",
        "inputs": "vs code 0606",
        "runAfter": {}
      },
      "Send_message": {
        "type": "ServiceProvider",
        "inputs": {
          "parameters": {
            "entityName": "test",
            "message": {
              "contentData": {
                "a": "b"
              }
            }
          },
          "serviceProviderConfiguration": {
            "connectionName": "serviceBus",
            "operationId": "sendMessage",
            "serviceProviderId": "/serviceProviders/serviceBus"
          }
        },
        "runAfter": {
          "Compose": [
            "SUCCEEDED"
          ]
        },
        "trackedProperties": {}
      },
      "Send_an_email_(V2)": {
        "type": "ApiConnection",
        "inputs": {
          "host": {
            "connection": {
              "referenceName": "office365-2"
            }
          },
          "method": "post",
          "body": {
            "To": "v-govubilish@microsoft.com",
            "Subject": "Vs code 06/06/2023",
            "Body": "<p>@{outputs('Compose')}</p>",
            "Importance": "Normal"
          },
          "path": "/v2/Mail"
        },
        "runAfter": {
          "Send_message": [
            "SUCCEEDED"
          ]
        }
      }
    },
    "contentVersion": "1.0.0.0",
    "outputs": {},
    "triggers": {
      "When_a_HTTP_request_is_received": {
        "type": "Request",
        "kind": "Http"
      }
    }
  },
  "connectionReferences": {
    "serviceBus": {
      "connection": {
        "id": "/serviceProviders/serviceBus/connections/serviceBus"
      },
      "connectionName": "abc",
      "api": {
        "id": "/serviceProviders/serviceBus"
      }
    },
    "office365-2": {
      "connection": {
        "id": "/subscriptions/53ce23c6-ff79-490b-a7fb-9590fe7a414a/resourceGroups/VSCode-v-govubilish/providers/Microsoft.Web/connections/office365-11"
      },
      "connectionName": "office365-11",
      "api": {
        "id": "/subscriptions/53ce23c6-ff79-490b-a7fb-9590fe7a414a/providers/Microsoft.Web/locations/centralus/managedApis/office365"
      },
      "authentication": {
        "type": "ManagedServiceIdentity"
      }
    }
  },
  "parameters": {}
}

VS code Workflow JSON: 

{
    "definition": {
        "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
        "actions": {
            "Response": {
                "type": "Response",
                "kind": "Http",
                "inputs": {
                    "statusCode": 200
                },
                "runAfter": {
                    "Send_an_email_(V2)": [
                        "SUCCEEDED"
                    ]
                }
            },
            "Compose": {
                "type": "Compose",
                "inputs": "vs code 0606",
                "runAfter": {}
            },
            "Send_message": {
                "type": "ServiceProvider",
                "inputs": {
                    "parameters": {
                        "entityName": "test",
                        "message": {
                            "contentData": {
                                "a": "b"
                            }
                        }
                    },
                    "serviceProviderConfiguration": {
                        "connectionName": "serviceBus",
                        "operationId": "sendMessage",
                        "serviceProviderId": "/serviceProviders/serviceBus"
                    }
                },
                "runAfter": {
                    "Compose": [
                        "SUCCEEDED"
                    ]
                },
                "trackedProperties": {}
            },
            "Send_an_email_(V2)": {
                "type": "ApiConnection",
                "inputs": {
                    "host": {
                        "connection": {
                            "referenceName": "office365-2"
                        }
                    },
                    "method": "post",
                    "body": {
                        "To": "v-govubilish@microsoft.com",
                        "Subject": "Vs code 06/06/2023",
                        "Body": "<p>@{outputs('Compose')}</p>",
                        "Importance": "Normal"
                    },
                    "path": "/v2/Mail"
                },
                "runAfter": {
                    "Send_message": [
                        "SUCCEEDED"
                    ]
                }
            }
        },
        "contentVersion": "1.0.0.0",
        "outputs": {},
        "triggers": {
            "When_a_HTTP_request_is_received": {
                "type": "Request",
                "kind": "Http"
            }
        }
    },
    "kind": "Stateful"
}

Screenshots or Videos

image image

Additional context

Artifacts details:

  1. VS Code extension: vscode-azurelogicapps-2.24.3.vsix
  2. NuGet package: https://artprodeussu2.artifacts.visualstudio.com/A41bf5486-7392-4b7a-a7e3-a735c767e3b3/b32aa71e-8ed2-41b2-9d77-5bc261222004/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL21zYXp1cmUvcHJvamVjdElkL2IzMmFhNzFlLThlZDItNDFiMi05ZDc3LTViYzI2MTIyMjAwNC9idWlsZElkLzc0MTk5ODA4L2FydGlmYWN0TmFtZS9kcm9wX2J1aWxkX0J1aWxkQXJ0aWZhY3RzX1dpbmRvd3M1/content?format=file&subPath=%2FMicrosoft.Azure.Workflows.WebJobs.Extension.1.25.1.nupkg
  3. Extension Bundle (CDN URL): https://cdnforlogicappsv2.blob.core.windows.net/logicapps-vendortesting
  4. Extension Bundle (Direct Download): https://artprodeussu2.artifacts.visualstudio.com/A41bf5486-7392-4b7a-a7e3-a735c767e3b3/b32aa71e-8ed2-41b2-9d77-5bc261222004/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL21zYXp1cmUvcHJvamVjdElkL2IzMmFhNzFlLThlZDItNDFiMi05ZDc3LTViYzI2MTIyMjAwNC9idWlsZElkLzc0MjAxMjgxL2FydGlmYWN0TmFtZS9kcm9wX2J1aWxkX0J1aWxkQXJ0aWZhY3RzX1dpbmRvd3M1/content?format=file&subPath=%2FMicrosoft.Azure.Functions.ExtensionBundle.Workflows.1.25.1_any-any.zip

AB#24188832

AB#24192914

vgouth commented 1 year ago

Console errors :

neH2MWIXoRl4.js:3 Core.SerializationException: Workflow has invalid connections on the following operations: Send_anemail(V2) at https://afd-v2.hosting-ms.portal.azure.net/ema/Content/Dynamic/neH2MWIXoRl4.js:3:4865270 at Generator.next () at https://afd-v2.hosting-ms.portal.azure.net/ema/Content/Dynamic/neH2MWIXoRl4.js:3:4651580 at new Promise () at JK (https://afd-v2.hosting-ms.portal.azure.net/ema/Content/Dynamic/neH2MWIXoRl4.js:3:4651325) at o3 (https://afd-v2.hosting-ms.portal.azure.net/ema/Content/Dynamic/neH2MWIXoRl4.js:3:4865037) at https://afd-v2.hosting-ms.portal.azure.net/ema/Content/Dynamic/neH2MWIXoRl4.js:3:5041342 at https://reactblade-ms.portal.azure.net//Content/Dynamic/3KsPtNwXSeTh.js:16:2806 at Object.next (https://reactblade-ms.portal.azure.net//Content/Dynamic/3KsPtNwXSeTh.js:16:2911) at https://reactblade-ms.portal.azure.net//Content/Dynamic/3KsPtNwXSeTh.js:16:1837 at new Promise () at __awaiter (https://reactblade-ms.portal.azure.net//Content/Dynamic/3KsPtNwXSeTh.js:16:1582) at Object.mutationFn (https://afd-v2.hosting-ms.portal.azure.net/ema/Content/Dynamic/neH2MWIXoRl4.js:3:5041205) at Object.fn (https://afd-v2.hosting-ms.portal.azure.net/ema/Content/Dynamic/neH2MWIXoRl4.js:3:2493387) at c (https://afd-v2.hosting-ms.portal.azure.net/ema/Content/Dynamic/neH2MWIXoRl4.js:3:2521486) at new u (https://afd-v2.hosting-ms.portal.azure.net/ema/Content/Dynamic/neH2MWIXoRl4.js:3:2522254) at t.executeMutation (https://afd-v2.hosting-ms.portal.azure.net/ema/Content/Dynamic/neH2MWIXoRl4.js:3:2493325) at https://afd-v2.hosting-ms.portal.azure.net/ema/Content/Dynamic/neH2MWIXoRl4.js:3:2492326

preetriti1 commented 1 year ago

The invalid connection issue is now fixed in latest deployment, but the remaining and active issue from this is - If LA is deployed to different region from what was selected in vscode local project then while creating new connection we should take location from apiId instead of location from workflow app, this would make sure we have successful connection creation.

vgouth commented 1 year ago

Intermittent Issue repro in the latest request in VS code run history with status code as 200.

Artifacts details:

1.VS Code extension: vscode-azurelogicapps-2.24.3.vsix 2.NuGet package: https://artprodeussu2.artifacts.visualstudio.com/A41bf5486-7392-4b7a-a7e3-a735c767e3b3/b32aa71e-8ed2-41b2-9d77-5bc261222004/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL21zYXp1cmUvcHJvamVjdElkL2IzMmFhNzFlLThlZDItNDFiMi05ZDc3LTViYzI2MTIyMjAwNC9idWlsZElkLzc0NTYyNjAxL2FydGlmYWN0TmFtZS9kcm9wX2J1aWxkX0J1aWxkQXJ0aWZhY3RzX1dpbmRvd3M1/content?format=file&subPath=%2FMicrosoft.Azure.Workflows.WebJobs.Extension.1.26.1.nupkg 3.Extension Bundle (CDN URL): https://cdnforlogicappsv2.blob.core.windows.net/logicapps-vendortesting 4.Extension Bundle (Direct Download): https://cdnforlogicappsv2.blob.core.windows.net/logicapps-vendortesting/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle.Workflows/1.26.1/Microsoft.Azure.Functions.ExtensionBundle.Workflows.1.26.1_any-any.zip

image

vgouth commented 1 year ago

Issue Repro in the new VSIX

With new VSIX (2.24.6), Getting the same error message popup with 200 as status code only in VS code for office-365 after deploying the workflow and running it. In portal when we open the same run history we are not getting the error message popup

Artifacts details:

1.VS Code extension: vscode-azurelogicapps-2.24.6.vsix 2.NuGet package: https://artprodeussu2.artifacts.visualstudio.com/A41bf5486-7392-4b7a-a7e3-a735c767e3b3/b32aa71e-8ed2-41b2-9d77-5bc261222004/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL21zYXp1cmUvcHJvamVjdElkL2IzMmFhNzFlLThlZDItNDFiMi05ZDc3LTViYzI2MTIyMjAwNC9idWlsZElkLzc0NTYyNjAxL2FydGlmYWN0TmFtZS9kcm9wX2J1aWxkX0J1aWxkQXJ0aWZhY3RzX1dpbmRvd3M1/content?format=file&subPath=%2FMicrosoft.Azure.Workflows.WebJobs.Extension.1.26.1.nupkg 3.Extension Bundle (CDN URL): https://cdnforlogicappsv2.blob.core.windows.net/logicapps-vendortesting 4.Extension Bundle (Direct Download): https://cdnforlogicappsv2.blob.core.windows.net/logicapps-vendortesting/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle.Workflows/1.26.1/Microsoft.Azure.Functions.ExtensionBundle.Workflows.1.26.1_any-any.zip

image image

vgouth commented 1 year ago

Issue repro in latest request

With new VSIX (2.28.3), Getting the same error message popup with 200 as status code only in VS code for office-365 after deploying the workflow and running it. In portal when we open the same run history we are not getting the error message popup

Artifacts details:

1.VS Code extension: vscode-azurelogicapps-2.28.3.vsix 2.Nuget package: https://artprodeussu2.artifacts.visualstudio.com/A41bf5486-7392-4b7a-a7e3-a735c767e3b3/b32aa71e-8ed2-41b2-9d77-5bc261222004/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL21zYXp1cmUvcHJvamVjdElkL2IzMmFhNzFlLThlZDItNDFiMi05ZDc3LTViYzI2MTIyMjAwNC9idWlsZElkLzc1MzA5MDMwL2FydGlmYWN0TmFtZS9kcm9wX2J1aWxkX0J1aWxkQXJ0aWZhY3RzX1dpbmRvd3M1/content?format=file&subPath=%2FMicrosoft.Azure.Workflows.WebJobs.Extension.1.28.2.nupkg 3.Extension Bundle (CDN URL): https://cdnforlogicappsv2.blob.core.windows.net/logicapps-vendortesting 4.Extension Bundle (Direct Download): https://cdnforlogicappsv2.blob.core.windows.net/logicapps-vendortesting/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle.Workflows/1.28.2/Microsoft.Azure.Functions.ExtensionBundle.Workflows.1.28.2_any-any.zip

image image

ccastrotrejo commented 1 year ago

I was able to repro this, will make a fix and will update thread.