cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
John_Martel
Frequent Visitor

Custom Connector Function failing with the Data Returned in the Response is Invalid

I have an Azure Function in my custom connector that returns "single" or "multi". I have built a Custom Connector (code below) and tested and it works fine (response below). As expected the body of the response has a single word. When I call the function from PowerApps i get "Data Returned in the Response in Invalid".

 

 

 

/SingleOrMulti:
    get:
      responses:
        '200':
          description: Success
          schema: {title: Similarity, type: string}
      summary: SingleOrMulti
      description: SingleOrMulti
      operationId: get-SingleOrMulti
      parameters:
      - {name: string1, in: query, type: string}

 

 

 

 
 

Response.PNG

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Re: Custom Connector Function failing with the Data Returned in the Response is Invalid

Hi @John_Martel ,

Could you please share a bit more about the formula you executed within your canvas app?

Do you mean your Azure function could return a single value (Text String value)?

 

Based on the OpenAPI JSON definition that you mentioned, I could not find any syntax error with it. Please make sure your whole OpenAPI definition file looks like below:

{
  "swagger": "2.0",
  "info": {
    "version": "1.0.0",
    "title": "MyAzureFunction"
  },
  "host": "azurefn.azurewebsites.net",
  "paths": {
    "/api/HttpTriggerCSharp1": {
      "get": {
        "description": "Calls my azure function over https",
        "operationId": "RunThis",
        "parameters": [
          {
            "name": "code",
            "in": "query",
            "description": "code",
            "default": "h6ztu…[your code here]…i",
            "type": "string"
          },
          {
            "name": "name",
            "in": "query",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "schema": {
              "title": "The response of the api.",
              "type": "string"
            }
          }
        }
      }
    }
  }
}

More details about the creating a custom connector based on Azure function, please refer to the following blog:

https://powerapps.microsoft.com/de-de/blog/using-azure-functions-in-powerapps/

 

Please check if the result your Azure function returned is always a Text string value. As an alternative solution, you could consider re-define your Azure function, to make it return a Object value. Then based on the modified Azure function, re-generate a new custom connector, check if the issue is solved.

 

Within your canvas app, please execute your custom connector action within Behavior property of a control, e.g. OnSelect property of a button, rather than Non-Behavior property of a control.  Set the OnSelect property of a button to following:

Set(ReturnedValue, 'Custom Connector'.get-SingleOrMulti("xxxx"))

then check if the ReturnedValue variable is populated with proper value

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Community Support
Community Support

Re: Custom Connector Function failing with the Data Returned in the Response is Invalid

Hi @John_Martel ,

Could you please share a bit more about the formula you executed within your canvas app?

Do you mean your Azure function could return a single value (Text String value)?

 

Based on the OpenAPI JSON definition that you mentioned, I could not find any syntax error with it. Please make sure your whole OpenAPI definition file looks like below:

{
  "swagger": "2.0",
  "info": {
    "version": "1.0.0",
    "title": "MyAzureFunction"
  },
  "host": "azurefn.azurewebsites.net",
  "paths": {
    "/api/HttpTriggerCSharp1": {
      "get": {
        "description": "Calls my azure function over https",
        "operationId": "RunThis",
        "parameters": [
          {
            "name": "code",
            "in": "query",
            "description": "code",
            "default": "h6ztu…[your code here]…i",
            "type": "string"
          },
          {
            "name": "name",
            "in": "query",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "schema": {
              "title": "The response of the api.",
              "type": "string"
            }
          }
        }
      }
    }
  }
}

More details about the creating a custom connector based on Azure function, please refer to the following blog:

https://powerapps.microsoft.com/de-de/blog/using-azure-functions-in-powerapps/

 

Please check if the result your Azure function returned is always a Text string value. As an alternative solution, you could consider re-define your Azure function, to make it return a Object value. Then based on the modified Azure function, re-generate a new custom connector, check if the issue is solved.

 

Within your canvas app, please execute your custom connector action within Behavior property of a control, e.g. OnSelect property of a button, rather than Non-Behavior property of a control.  Set the OnSelect property of a button to following:

Set(ReturnedValue, 'Custom Connector'.get-SingleOrMulti("xxxx"))

then check if the ReturnedValue variable is populated with proper value

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

John_Martel
Frequent Visitor

Re: Custom Connector Function failing with the Data Returned in the Response is Invalid

Thanks I was bale to get working by converting the response to a JSon string, and then changing the Swagger format to Object.

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Power Platform 2020 release wave 1 plan

Power Platform 2020 release wave 1 plan

Features releasing from April 2020 through September 2020

Top Solution Authors
Top Kudoed Authors
Users online (8,886)