Azure / LogicAppsUX

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

Connection does not substitute appsettings when calling connector #5481

Closed zzznz27 closed 2 weeks ago

zzznz27 commented 3 weeks ago

Describe the Bug with repro steps

  1. Add a managed API connector to your logic app in VSCode designer
  2. Complete connections steps
  3. Reload the designer
  4. Connector is unable to initialize operation

What type of Logic App Is this happening in?

Standard (VSCode)

Which operating system are you using?

Windows

Are you using new designer or old designer

New Designer

Did you refer to the TSG before filing this issue? https://aka.ms/lauxtsg

Yes

Workflow JSON

No response

Screenshots or Videos

Custom Connector not loading

image

image

Browser

VScode

Additional context

I have seen this issue occur with both Custom API connectors and managed Api connectors

Looking at the console i can see the values have not been substituted

Request URL: https://management.azure.com//subscriptions/@%7Bappsetting('WORKFLOWS_SUBSCRIPTION_ID')%7D/resourceGroups/@%7Bappsetting('WORKFLOWS_RESOURCE_GROUP_NAME')%7D/providers/@%7Bappsetting('WORKFLOWS_LOCATION_NAME')%7D/customApis/EcaseWebServices?api-version=2018-07-01-preview
Request Method: GET
Status Code: 400 Bad Request
Remote Address: <sanitized>
Referrer Policy: strict-origin-when-cross-origin
{
    "error": {
        "code": "InvalidSubscriptionId",
        "message": "The provided subscription identifier '@{appsetting('WORKFLOWS_SUBSCRIPTION_ID')}' is malformed or invalid."
    }
}
zzznz27 commented 3 weeks ago

Another example with the azure tables managed api connector

Request URL: https://management.azure.com//subscriptions/@%7Bappsetting('WORKFLOWS_SUBSCRIPTION_ID')%7D/providers/Microsoft.Web/locations/@%7Bappsetting('WORKFLOWS_LOCATION_NAME')%7D/managedApis/azuretables?api-version=2018-07-01-preview
Request Method: GET
Status Code: 400 Bad Request
Remote Address: 4.150.240.10:443
Referrer Policy: strict-origin-when-cross-origin
ccastrotrejo commented 3 weeks ago

Hi @zzznz27 thanks for raising this issue. Usually this happens when the appsetting is not in your local.settings.json file. Could you pleas verify the WORKFLOWS_SUBSCRIPTION_ID indeed exists in your local.settings.json file?

This might also happen when the WORKFLOWS_SUBSCRIPTION_ID is an empty string. (this happens when user skips to use azure resources)

There are 2 ways to solve this:

zzznz27 commented 3 weeks ago

I have confirmed the app setting is there and was set automatically when using the 'Use connectors from Azure' option

If I take the value out and put it in the connectors.json it then throws the same error for WORKFLOWS_RESOURCE_GROUP

If I hard code both values into connections.json it works

ccastrotrejo commented 3 weeks ago

@zzznz27 Which version of the extension are you using?

zzznz27 commented 3 weeks ago

I am on the latest version

V4.57.6

-------- Original message -------- From: Carlos Emiliano Castro Trejo @.> Date: 24/8/24 8:47 am (GMT+10:00) To: Azure/LogicAppsUX @.> Cc: Zach Herb @.>, Mention @.> Subject: Re: [Azure/LogicAppsUX] Connection does not substitute appsettings when calling connector (Issue #5481)

@zzznz27https://github.com/zzznz27 Which version of the extension are you using?

— Reply to this email directly, view it on GitHubhttps://github.com/Azure/LogicAppsUX/issues/5481#issuecomment-2307897320, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AJHK74CXGHJQVBRDVZFBCJDZS63WJAVCNFSM6AAAAABM7MXKISVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBXHA4TOMZSGA. You are receiving this because you were mentioned.Message ID: @.***>

ccastrotrejo commented 2 weeks ago

@zzznz27 I can't figure out another way on why this could be happening unless your local.settings.json doesn't have the settings. Do you mind sharing with me your project zipped to my email? ccastrotrejo@microsoft.com

zzznz27 commented 2 weeks ago

Sure i will send it shortly I will remove the authorization secret values for security as well

ccastrotrejo commented 2 weeks ago

@zzznz27 Thanks for sharing the project with me. I took a look and it does seem that there is a missing implementation on the vscode side. I will make the proper changes to match Azure Portal behavior. Thanks!

ccastrotrejo commented 2 weeks ago

@zzznz27 In the meantime, please keep using your workaround