Reputation: 1361
I am calling an Azure Function(HTTP trigger) in Azure Data Factory and the body is coming from a lookup activity (@activity('Lookup1').output.value) which is something like this
"body":[
{
"BaseObject": "2|03|01|01",
"BaseObjectDescription": "Cent",
"CreateDate": "30.09.2021"
},
{
"BaseObject": "9|03|01|01",
"BaseObjectDescription": "Pent",
"CreateDate": "30.09.2021"
}]
The above json when passed as body to Azure function activity, I get error as "Unexpected character encountered while parsing value: S." But if I hardcode and pass the same value in body of Azure function I get the output. When I hardcode it, I see in debug mode the body is passed as something like this
"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]"
So question is how do I change the json I am getting from lookup activity to something like above so that my Function recognizes this as body in Azure Data Factory.
Here is my configuration of Azure Function Linked Service. Why open in Azure Portal is Disabled. The error I get in ADF for Azure Function Activity is
"
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.
Upvotes: 1
Views: 742
Reputation: 5074
Use the lookup activity value as @activity('Lookup1').output.value[0]
inside the body of Azure Function activity.
Lookup activity output:
Azure Function activity settings:
Body: @activity('Lookup1').output.value[0]
The value shown in input to Azure functions:
Upvotes: 1