Azure 数据工厂中 Azure 函数的 GET 方法失败
GET method for an Azure function within Azure Data Factory fails
我正在尝试调用基于 GET
请求构建的 HTTP
触发 Azure function
。我按照推荐的步骤设置链接服务,函数本身通过 POSTMAN 或互联网浏览器使用查询字符串,但当我尝试通过数据工厂调用时失败。
{
"errorCode": "3608",
"message": "Call to provided Azure function '' failed with status-'NotFound' and message - 'Invoking Azure function failed with HttpStatusCode - NotFound.'.",
"failureType": "UserError",
"target": "Azure Function1",
"details": []
}
我遇到了另一个 Whosebug post ,其中提到了 ADF 的 JSON
响应。
我已经更改了我的 python 代码以提供 HTTP
响应作为 JSON
对象,如下所示
def main(req: func.HttpRequest) -> func.HttpResponse:
logging.info('Python HTTP trigger function processed a request.')
statename = req.params.get('statename')
if not statename:
try:
req_body = req.get_json()
except ValueError:
pass
else:
statename = req_body.get('statename')
if statename:
initiate_main(statename)
host.close()
function_message = {"Response":"Successfully trasnferred BOM files"}
return func.HttpResponse(
json.dumps(function_message),
mimetype="application/json",
status_code=200)
else:
function_message = {"Response":"Error in transferring files"}
return func.HttpResponse(
json.dumps(function_message),
mimetype="application/json",
status_code=400)
但这也无济于事。
事实证明,我使用了错误的 URI,在末尾添加了 api
,而我本应提供简单的函数名称
我正在尝试调用基于 GET
请求构建的 HTTP
触发 Azure function
。我按照推荐的步骤设置链接服务,函数本身通过 POSTMAN 或互联网浏览器使用查询字符串,但当我尝试通过数据工厂调用时失败。
{
"errorCode": "3608",
"message": "Call to provided Azure function '' failed with status-'NotFound' and message - 'Invoking Azure function failed with HttpStatusCode - NotFound.'.",
"failureType": "UserError",
"target": "Azure Function1",
"details": []
}
我遇到了另一个 Whosebug post JSON
响应。
我已经更改了我的 python 代码以提供 HTTP
响应作为 JSON
对象,如下所示
def main(req: func.HttpRequest) -> func.HttpResponse:
logging.info('Python HTTP trigger function processed a request.')
statename = req.params.get('statename')
if not statename:
try:
req_body = req.get_json()
except ValueError:
pass
else:
statename = req_body.get('statename')
if statename:
initiate_main(statename)
host.close()
function_message = {"Response":"Successfully trasnferred BOM files"}
return func.HttpResponse(
json.dumps(function_message),
mimetype="application/json",
status_code=200)
else:
function_message = {"Response":"Error in transferring files"}
return func.HttpResponse(
json.dumps(function_message),
mimetype="application/json",
status_code=400)
但这也无济于事。
事实证明,我使用了错误的 URI,在末尾添加了 api
,而我本应提供简单的函数名称