Hi all,
I'd be very grateful for any help here - this error is in the category of Power Apps being 95% fantastic and the final 5% painful frustration.
I have a new custom API deployed via Azure API Management for use by our external partners to access data in one of our corporate systems.
I'm trying to build a Power App front end to allow some of our internal staff to test the data it returns as part of our test process before releasing to external partners.
There are 11 operations in the API. All are simple GETs.
When I create custom connector with a new connection and try to call the API from a canvas Power App, I get the message in the Power App: "The Data return in the response is invalid, Response data should be a valid JSON object". I've looked at other forum messages with the same error and can't see any solution to my problem.
Everything else about using the API looks fine:
- I can test operations from the Azure Management dev portal "Try It" feature with no problem
- Calls from Postman are fine
- The test feature within the Custom Connector returns 200 with data
- I can even wrap the API call into a Power Automate flow and respond in a Request/Response action to Power Apps and see the data.
It's just the final step of calling it directly within Power Apps that gives me the message above. In Power Apps Monitor tool, the body return is blank when all the other test tools is showing a simple JSON array. I suspect this is the problem but I can't figure out how to use this observation. I really don't want to hand roll all 11 operations into separate flows as a work around.
I've also added flow.microsoft.com to the CORS policy of the API as described here https://powerusers.microsoft.com/t5/Connector-Development/Property-quot-quot-type-mismatch-Expected-quot-object-quot/m-p/1283840#M461
I'm out of ideas - any suggestions would be gratefully received.
Many thanks
Jonathan
With some help from Microsoft, we managed to solve this. The problem turned out to be related to the API being being deployed behind Azure API Management.
The solution was to update the CORS policy for the API. To do this, in the Azure Portal, select the API Management resource being used, APIs blade, All APIs, Inbound Processing, select the cors policy and add the following:
<policies>
<inbound>
<cors allow-credentials="true">
<allowed-origins>
<origin>https://flow.microsoft.com</origin>
<origin>https://pcmsapidev.developer.azure-api.net</origin>
<origin>https://create.powerapps.com</origin>
<origin>https://content.powerapps.com</origin>
<origin>https://apps.powerapps.com</origin>
<origin>https://make.powerapps.com</origin>
<origin>https://authoring.eu-XXXXX.gateway.prod.island.powerapps.com</origin>
</allowed-origins>
etc.....
It was the gateway.prod.island.powerapps.com line here that finally got this working after a few iterations with the support team. I have not tried it with the lines above removed.
You find the URL to use for your value of eu-XXXXX.gateway.prod.island.powerapps.com in the maker environment for your Power App under settings, Session Details, "Cluster URI suffix".
If you find the above in any Microsoft documentation, your search skills are better than mine.
Thanks for the reply. I've added that to the header and the problem is still there. See below from the header infor on the request copied from Monitor in Power Apps.
"headers": {
"Accept": "application/json",
"x-ms-user-agent": "PowerApps/3.22072.25 (Web AuthoringTool; AppName=XXXX)",
"x-ms-client-session-id": "XXXXX",
"x-ms-client-request-id": " XXXXX ",
"x-ms-client-environment-id": "/providers/Microsoft.PowerApps/environments/XXXX",
"x-ms-client-app-id": "/providers/Microsoft.PowerApps/apps/XXXX",
"x-ms-client-tenant-id": "XXXX",
"x-ms-client-object-id": "XXXX",
"Accept-Language": "en-GB",
"Cache-Control": "no-cache, no-store",
"x-ms-request-method": "GET",
"x-ms-request-url": "/apim/XXXX"
},
WarrenBelz
42
Most Valuable Professional
mmbr1606
41
Super User 2025 Season 1
MS.Ragavendar
36