在 Azure 数据工厂中将内容作为主体传递的问题
Issue in passing content as a body in Azure Data Factory
我正在 Azure 数据工厂中调用 Azure 函数(HTTP 触发器),正文来自查找 activity (@activity('Lookup1').output.value) 是这样的
"body":[
{
"BaseObject": "2|03|01|01",
"BaseObjectDescription": "Cent",
"CreateDate": "30.09.2021"
},
{
"BaseObject": "9|03|01|01",
"BaseObjectDescription": "Pent",
"CreateDate": "30.09.2021"
}]
上面的 json 当作为正文传递给 Azure 函数 activity 时,我收到错误消息“解析值时遇到意外字符:S”。但是,如果我在 Azure 函数体中硬编码并传递相同的值,我就会得到输出。当我对其进行硬编码时,我在调试模式下看到正文是这样传递的
"body": "[\n {\n \"BaseObject\": \"02|03|01|01\",\n \"BaseObjectDescription\": \"Cent\",\n \"CreateDate\": \"30.09.2021\" },\n {\n \"BaseObject\": \"04|03|01|01\",\n \"BaseObjectDescription\": \"Pent",\n \"CreateDate\": \"21.09.2021\",\n },\n]"
所以问题是如何将我从查找 activity 得到的 json 更改为类似上面的内容,以便我的函数将其识别为 Azure 数据工厂中的正文。
这是我的 Azure Function Linked Service 配置。为什么在 Azure 门户中打开被禁用。我在 ADF for Azure Function Activity 中得到的错误是
"
Call to provided Azure function 'Function1' failed with status-'InternalServerError' and message - 'Invoking Azure function failed with HttpStatusCode - InternalServerError.'." While in Azure Function Logs I see the error message as below:
2022-01-06T10:14:42.403 [Information] C# HTTP trigger function processed a request.
2022-01-06T10:14:42.826 [Error] Executed 'Function1' (Failed, Id=c7f2488f-e08f-49a3-8f10-4e82a10d9ac0, Duration=270ms)The argument 'length' is smaller than minimum of '1' (Parameter 'length')
2022-01-06T10:16:40.934 [Information] Executing 'Function1' (Reason='This function was programmatically called via the host APIs.', Id=5ff54bce-679d-4892-87a0-fb342ff02cc7)
2022-01-06T10:16:40.934 [Information] C# HTTP trigger function processed a request.
2022-01-06T10:16:40.994 [Error] Executed 'Function1' (Failed, Id=5ff54bce-679d-4892-87a0-fb342ff02cc7, Duration=2ms)Specified method is not supported.Specified method is not supported.
在 Azure 函数 activity.
的主体内使用 查找 activity 值作为 @activity('Lookup1').output.value[0]
查找activity输出:
Azure 函数 activity 设置:
正文: @activity('Lookup1').output.value[0]
Azure 函数输入中显示的值:
我正在 Azure 数据工厂中调用 Azure 函数(HTTP 触发器),正文来自查找 activity (@activity('Lookup1').output.value) 是这样的
"body":[
{
"BaseObject": "2|03|01|01",
"BaseObjectDescription": "Cent",
"CreateDate": "30.09.2021"
},
{
"BaseObject": "9|03|01|01",
"BaseObjectDescription": "Pent",
"CreateDate": "30.09.2021"
}]
上面的 json 当作为正文传递给 Azure 函数 activity 时,我收到错误消息“解析值时遇到意外字符:S”。但是,如果我在 Azure 函数体中硬编码并传递相同的值,我就会得到输出。当我对其进行硬编码时,我在调试模式下看到正文是这样传递的
"body": "[\n {\n \"BaseObject\": \"02|03|01|01\",\n \"BaseObjectDescription\": \"Cent\",\n \"CreateDate\": \"30.09.2021\" },\n {\n \"BaseObject\": \"04|03|01|01\",\n \"BaseObjectDescription\": \"Pent",\n \"CreateDate\": \"21.09.2021\",\n },\n]"
所以问题是如何将我从查找 activity 得到的 json 更改为类似上面的内容,以便我的函数将其识别为 Azure 数据工厂中的正文。
这是我的 Azure Function Linked Service 配置。为什么在 Azure 门户中打开被禁用。我在 ADF for Azure Function Activity 中得到的错误是
"
Call to provided Azure function 'Function1' failed with status-'InternalServerError' and message - 'Invoking Azure function failed with HttpStatusCode - InternalServerError.'." While in Azure Function Logs I see the error message as below:
2022-01-06T10:14:42.403 [Information] C# HTTP trigger function processed a request.
2022-01-06T10:14:42.826 [Error] Executed 'Function1' (Failed, Id=c7f2488f-e08f-49a3-8f10-4e82a10d9ac0, Duration=270ms)The argument 'length' is smaller than minimum of '1' (Parameter 'length')
2022-01-06T10:16:40.934 [Information] Executing 'Function1' (Reason='This function was programmatically called via the host APIs.', Id=5ff54bce-679d-4892-87a0-fb342ff02cc7)
2022-01-06T10:16:40.934 [Information] C# HTTP trigger function processed a request.
2022-01-06T10:16:40.994 [Error] Executed 'Function1' (Failed, Id=5ff54bce-679d-4892-87a0-fb342ff02cc7, Duration=2ms)Specified method is not supported.Specified method is not supported.
在 Azure 函数 activity.
的主体内使用 查找 activity 值作为@activity('Lookup1').output.value[0]
查找activity输出:
Azure 函数 activity 设置:
正文: @activity('Lookup1').output.value[0]
Azure 函数输入中显示的值: