I keep getting connection timeouts when I try to create a dataset (HTTP) in an Azure Data Factory which is based on a Azure Function (HTTP trigger):
The cloud service request timed out. Please retry. Activity ID:9d70efcd-c842-4484-9313-4872208a2a9e
However, if I call function from anywhere else e.g. from apitester.com, I get the desired response:
- Request URL: https://srf-scadapa-fa2-windows.azurewebsites.net/api/HttpTriggerPython32?code=L5WVNJh8loDv3mZFcD/AKatNRoYfYoHlDbEBk4AEGrbDA39ddAXsyg==
- Request method: post
- Request body: { "group_name": "Azure POC" }
Response body:
{"timestamp":"2018-09-24 14:23:42","python_version":"3.5.4 (v3.5.4:3f56838, Aug 8 2017, 02:17:05) [MSC v.1900 64 bit (AMD64)]"}
The source code of the function HttpTriggerPython32 is as follows:
import os, sys, json
from datetime import datetime
postreqdata = json.loads(open(os.environ['req']).read())
responseData = {
'timestamp' : datetime.now(pytz.timezone("Europe/Zurich")).strftime("%Y-%m-%d %H:%M:%S"),
'python_version' : sys.version
}
response = open(os.environ['res'], 'w')
response.write(str(responseData))
I've successfully added other 3rd party HTTP services as datasets in the data factory. Also, I've managed to call the function by using a Web activity. The error only occurs when I try to use the function as a dataset source.
To add the function as data factory dataset I created a new dataset with the following parameters:
{
"name": "HttpFile1",
"properties": {
"linkedServiceName": {
"referenceName": "AF_srfscadapa_af1",
"type": "LinkedServiceReference"
},
"type": "HttpFile",
"typeProperties": {
"format": {
"type": "JsonFormat",
"filePattern": "setOfObjects"
},
"relativeUrl": "HttpTriggerPython32?code=L5WVNJh8loDv3mZFcD/AKatNRoYfYoHlDbEBk4AEGrbDA39ddAXsyg==",
"requestMethod": "Post",
"requestBody": "{\n \"group_name\": \"Azure POC\"\n}"
}
}
}
The linked service "AF_srfscadapa_af1" is configured as follows:
- Connect via integration runtime: AutoResolveIntegrationRuntime
- Base URL: https://srf-scadapa-fa2-windows.azurewebsites.net/api/
- Server Certificate Validation: False
- Authentification type: Anonymous