I am also receiving the "InvalidImageUrl" error when passing a url of an image to be processed by the Computer Vision Powerapp connector. I used the action on select for a button:
ClearCollect(results, ComputerVisionAPI.OCRText("Image URL", <URL to Image>))As a work around I ended up having to create an Azure Function in Python to accept an HTTP Request and Call ComputerVisionAPI directly then create a JSON response. Then I created a custom connector for the new Azure Function. Then I call the above with the new custom connector only passing the url.
AZURE PYTHON FUNCTION
#Python Azure Function to Call ComputerVisionAPI
#Receives url as json object and then calls CompVis then returns List Object in JSON
import os
import json
import httplib, urllib2, base64
postreqdata = json.loads(open(os.environ['req']).read())
url = postreqdata['url']
req = urllib2.Request('https://westus.api.cognitive.microsoft.com/vision/v1.0/ocr')
req.add_header('Content-Type','application/json')
req.add_header('Ocp-Apim-Subscription-Key', '<KEY>')
res = urllib2.urlopen(req,json.dumps({'url': url}))
data = res.read()
parsed = json.loads(data)
textList = []
for regions in parsed['regions']:
for lines in regions['lines']:
for words in lines['words']:
textList.append(words.get('text'))
response = open(os.environ['res'], 'w')
response.write(json.dumps(textList, sort_keys=True, indent=2))
response.close()
SWAGGER FOR CUSTOM CONNECTOR
{
"swagger": "2.0",
"info": {
"description": "CompVISAPI",
"version": "CompVISAPI",
"title": "CompVISAPI"
},
"host": "<name_of_azure_functions>.azurewebsites.net",
"basePath": "/",
"schemes": [
"https"
],
"consumes": [],
"produces": [],
"paths": {
"/api/<name_of_function>": {
"post": {
"summary": "azure function to call Computer Vision API for powerapps",
"operationId": "OCRText",
"produces": [
"application/json; charset=utf-8"
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"type": "string"
}
},
"headers": {
"Cache-Control": {
"description": "Cache-Control",
"type": "string"
},
"Content-Encoding": {
"description": "Content-Encoding",
"type": "string"
},
"Content-Length": {
"description": "Content-Length",
"type": "integer"
},
"Content-Type": {
"description": "Content-Type",
"type": "string"
},
"Date": {
"description": "Date",
"type": "string"
},
"Expires": {
"description": "Expires",
"type": "integer"
},
"Pragma": {
"description": "Pragma",
"type": "string"
},
"Server": {
"description": "Server",
"type": "string"
},
"Vary": {
"description": "Vary",
"type": "string"
},
"X-AspNet-Version": {
"description": "X-AspNet-Version",
"type": "string"
},
"X-Powered-By": {
"description": "X-Powered-By",
"type": "string"
}
}
}
},
"parameters": [
{
"name": "Content-Type",
"in": "header",
"description": "",
"required": false,
"type": "string"
},
{
"name": "code",
"in": "query",
"type": "string",
"description": "",
"required": true
},
{
"name": "body",
"in": "body",
"schema": {
"description": "",
"type": "object",
"properties": {
"url": {
"type": "string",
"minLength": 1
}
},
"required": [
"url"
]
},
"description": "",
"required": true
}
],
"description": "jsw azure function"
}
}
},
"definitions": {},
"parameters": {},
"responses": {},
"securityDefinitions": {},
"security": [],
"tags": []
}It would be nice to not have to use this work around.