rithala / power-automate-tools

The Chrome/Edge extension that enables editing a Power Automate flow definition as JSON.
GNU General Public License v3.0
15 stars 3 forks source link

Value not accepted and InvalidOpenApiFlow #2

Closed 0xNinshu closed 4 months ago

0xNinshu commented 2 years ago

Hello,

I am having trouble I get this problem when I open your extension on a flow that has no issues:

image

If I attempt to save the workflow while this is still present. I get an error:

Error during saving the flow definition: Error: Request to XRM API failed with error: 'Message: Flow client error returned with status code "BadRequest" and details "{"error":{"code":"InvalidOpenApiFlow","message":"Flow save failed with code 'WorkflowRunActionInputsInvalidProperty' and message 'The 'inputs' of workflow run action 'List_rows_present_in_a_table' of type 'OpenApiConnection' should not have the property 'authentication'.'."}}". Code: 0x80060467 InnerError: '.

I would like to use your extension I think it's a great idea!

I included what I could out of the flow below some of the information was confidential, so I stripped it out.

It seems like the $schema reference might not be correct. Docs shows this link:

https://schema.management.azure.com/schemas/2016-06-01/Microsoft.Logic.json#

Thank you for the free cool extension!

{
  "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "$connections": {
      "defaultValue": {},
      "type": "Object"
    },
    "$authentication": {
      "defaultValue": {},
      "type": "SecureObject"
    },
    "AppShhh (crfea_AppShhh)": {
      "defaultValue": "",
      "type": "String",
      "metadata": {
        "schemaName": "crfea_AppShhh",
        "description": "Shhh"
      }
    },
     "App Id (crfea_ov-appId)": {
      "defaultValue": "",
      "type": "String",
      "metadata": {
        "schemaName": "crfea_ov-appId",
        "description":  "App Id / Client Id"
      }
    },
    "App Scope (crfea_appScope)": {
      "defaultValue": "https://microsoft.onmicrosoft.com/{tenantId}/.default",
      "type": "String",
      "metadata": {
        "schemaName": "crfea_appScope",
        "description": "Scope for service principal permissions"
      }
    },
    "OV Data (crfea_OVData)": {
      "defaultValue": {},
      "type": "Object",
      "metadata": {
        "schemaName": "crfea_OVData",
        "description": "Json Data"
      }
    }
  },
  "triggers": {
    "manual": {
      "metadata": {
        "operationMetadataId": "{guid}"
      },
      "type": "Request",
      "kind": "Button",
      "inputs": {
        "schema": {
          "type": "object",
          "properties": {},
          "required": []
        }
      }
    }
  },
  "actions": {
    "Get_Token": {
      "runAfter": {
        "Parse_Selected": [
          "Succeeded"
        ]
      },
      "metadata": {
        "operationMetadataId": "{guid}"
      },
      "type": "Http",
      "inputs": {
        "method": "POST",
        "uri": "https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/token",
        "headers": {
          "Accept": "*/*",
          "Content-Type": "application/x-www-form-urlencoded",
          "Accept-Encoding": "gzip, deflate, br"
        },
        "body": "grant_type=client_credentials&scope=@{parameters('App Scope (crfea_appScope)')}&client_secret=@{parameters('AppShhh (crfea_AppShhh)')}&client_id=@{parameters('App Id (crfea_ov-appId)')}"
      }
    },
    "List_rows_present_in_a_table": {
      "runAfter": {
        "Parse_Data": [
          "Succeeded"
        ]
      },
      "metadata": {
        "{fileId}": "/filepath",
        "operationMetadataId": "{guid}",
        "tableId": "{guid}"
      },
      "type": "OpenApiConnection",
      "inputs": {
        "path": "",
        "host": {
          "apiId": "/providers/Microsoft.PowerApps/apis/shared_excelonlinebusiness",
          "connectionName": "shared_excelonlinebusiness_1",
          "operationId": "GetItems"
        },
        "parameters": {
          "source": "groups/{guid}",
          "drive": "{driveId}",
          "file": "{fileId}",
          "table": "{guid}"
        },
        "authentication": {
          "value": "@json(decodeBase64(triggerOutputs().headers['X-MS-APIM-Tokens']))['$ConnectionKey']",
          "type": "Raw"
        }
      }
    },
    "Select": {
      "runAfter": {
        "List_rows_present_in_a_table": [
          "Succeeded"
        ]
      },
      "metadata": {
        "operationMetadataId": "{guid}"
      },
      "type": "Select",
      "inputs": {
        "from": "@outputs('List_rows_present_in_a_table')?['body/value']",
        "select": {
          "{propertyName1}": "@item()?['propertyName1']",
          "{propertyName2}": "@item()?['propertyName2']",
          "{propertyName3}": "@item()?['propertyName3']",
          "{propertyName4}": "@item()?['propertyName4']",
          "{propertyName5}": "@item()?['propertyName5']",
          "{propertyName6}": "@item()?['propertyName6']",
          "{propertyName7}": "@item()?['propertyName7']",
          "{propertyName8}": "@item()?['propertyName8']",
          "{propertyName9}": "@item()?['propertyName9']"
        }
      }
    },
    "Parse_Data": {
      "runAfter": {
        "Get_my_profile_(V2)": [
          "Succeeded"
        ]
      },
      "metadata": {
        "operationMetadataId": "{guid}"
      },
      "type": "ParseJson",
      "inputs": {
        "content": "@parameters('OV Data (crfea_OVData)')",
        "schema": {}
    },
    "Parse_Selected": {
      "runAfter": {
        "Select": [
          "Succeeded"
        ]
      },
      "metadata": {
        "operationMetadataId": "{guid}"
      },
      "type": "ParseJson",
      "inputs": {
        "content": "@body('Select')",
        "schema": {}
    },
    "Get_my_profile_(V2)": {
      "runAfter": {},
      "metadata": {
        "operationMetadataId": "{guid}"
      },
      "type": "OpenApiConnection",
      "inputs": {
        "host": {
          "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365users",
          "connectionName": "shared_office365users",
          "operationId": "MyProfile_V2"
        },
        "parameters": {},
        "authentication": {
          "value": "@json(decodeBase64(triggerOutputs().headers['X-MS-APIM-Tokens']))['$ConnectionKey']",
          "type": "Raw"
        }
      }
    },
    "HTTP_Webhook": {
      "runAfter": {
        "Get_Status_by_BatchId_and_RequestId": [
          "Succeeded"
        ]
      },
      "metadata": {
        "operationMetadataId": "{guid}"
      },
      "type": "HttpWebhook",
      "inputs": {
        "subscribe": {
          "method": "POST",
          "uri": "https://api.call.com/scrubbed",
          "headers": {
            "Accept": "application/json",
            "Authorization": "@{concat('Bearer ', body('Get_Token')?['access_token'])}"
          },
          "body": {}
        },
        "unsubscribe": {}
      }
    },
    "Parse_JSON": {
      "runAfter": {
        "HTTP_Webhook_Test": [
          "Succeeded"
        ]
      },
      "metadata": {
        "operationMetadataId": "{guid}"
      },
      "type": "ParseJson",
      "inputs": {
        "content": "@body('New_Request')",
        "schema": {}
        }
      }
    },
    "Get_Status": {
      "runAfter": {
        "Parse_JSON": [
          "Succeeded"
        ]
      },
      "metadata": {
        "operationMetadataId": "{guid}"
      },
      "type": "Http",
      "inputs": {
        "method": "GET",
        "uri": "@body('Parse_JSON')?['link']?['self']",
        "headers": {
          "Accept": "application/json",
          "Authorization": "@{concat('Bearer ', body('Get_Token')?['access_token'])}"
        }
      }
    },
    "New_Request": {
      "runAfter": {
        "Terminate": [
          "Succeeded"
        ]
      },
      "metadata": {
        "operationMetadataId": "{guid}"
      },
      "type": "Http",
      "inputs": {
        "method": "POST",
        "uri": "https://api.call.com/scrubbed",
        "headers": {
          "Accept": "application/json",
          "Authorization": "@{concat('Bearer ', body('Get_Token')?['access_token'])}"
        },
        "body": {}
        }
      }
    },
    "Terminate": {
      "runAfter": {
        "Get_Token": [
          "Succeeded"
        ]
      },
      "metadata": {
        "operationMetadataId": "{guid}"
      },
      "type": "Terminate",
      "inputs": {
        "runStatus": "Cancelled"
      }
    },
    "HTTP_Webhook_Test": {
      "runAfter": {
        "New_Request": [
          "Succeeded"
        ]
      },
      "metadata": {
        "operationMetadataId": "{guid}"
      },
      "type": "HttpWebhook",
      "inputs": {
        "subscribe": {
          "method": "POST",
          "uri": "https://api.call.com/scrubbed",
          "headers": {
            "Accept": "application/json",
            "Authorization": "@{concat('Bearer ', body('Get_Token')?['access_token'])}",
            "Connection": "keep-alive"
          },
          "body": {}
        },
        "unsubscribe": {}
      }
    }
  },
  "outputs": {}
}
rithala commented 4 months ago

The issue should be resolved by the 1.2 release. Please check again after updating the extension.