Azure / logicapps

Azure Logic Apps labs, samples, and tools
MIT License
368 stars 302 forks source link

Forms Recognizer action cannot be run with Optional features in the New Designer due to InvalidTemplate #1202

Open codyc1515 opened 1 month ago

codyc1515 commented 1 month ago

Describe the Bug with repro steps

  1. Create a Logic Apps "Form Recognizer" Connector with "Optional and Premium features" value of ["keyValuePairs"] - this is the only value I could find that work allow me to Save the Logic App .
  2. When the Logic App runs, it fails with InvalidTemplate Unable to process template language expressions in action 'Analyze_PDF_using_AI_with_Invoice_model' inputs at line '0' and column '0': 'Error reading string. Unexpected token: StartArray. Path 'queries.features'.'.

This was working before in the Legacy Designer with the exact same values.

What type of Logic App Is this happening in?

Standard (Portal)

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

{
  "type": "ApiConnection",
  "description": "",
  "inputs": {
    "host": {
      "connection": {
        "referenceName": "formrecognizer"
      }
    },
    "method": "post",
    "body": "@base64ToBinary(body('Get_the_PDF_attachment')?['contentBytes'])",
    "path": "/documentModels/@{encodeURIComponent('prebuilt-invoice')}:analyze",
    "queries": {
      "api-version": "2023-07-31",
      "pages": "@{variables('NumberPages')}",
      "features": [
        "keyValuePairs"
      ]
    }
  },
  "runAfter": {
    "Get_the_PDF_attachment": [
      "Succeeded"
    ]
  }
}

Screenshots or Videos

Before

This validates okay in the old designer.

image

After

The same does not in the new designer.

image

image

image

Browser

Edge

Additional context

No response

Eric-B-Wu commented 1 month ago

This seems like a connector issue. The Schema we're given is expecting the parameter Optional and Premium features to be an array and thus our validation will prevent saving of this as so. I'm transferring this to backend and going to start an internal thread with the connector owner on their schema

Eric-B-Wu commented 4 weeks ago

Hi @codyc1515 while we work with the connector team on this, you add an expression token to skip the validation as so, which should allow it to save:

Image