0
votes

I am calling an http triggered Azure function app in data factory pipeline using ADF function activity. It is executing successfully in debug mode, but when I publish that pipeline and run the same code using data factory triggers I get below error-

{
    "errorCode": "3600",
    "message": "Object reference not set to an instance of an object.",
    "failureType": "UserError",
    "target": "AzureFunction"
}

Please let me know if I need to make some additional properties changes or I am missing anything here. Also is there any way I can see what URL is getting generated when I call function app through function activity in ADF.

I have tried calling same function app using web activity in ADF and that is working fine in both debug and trigger mode.

Linked service code for Azure function

{
    "name": "linkedservicesAzureFunctions",
    "type": "Microsoft.DataFactory/factories/linkedservices",
    "properties": {
        "typeProperties": {
            "functionAppUrl": "https://xyz.azurewebsites.net",
            "functionKey": {
                "type": "AzureKeyVaultSecret",
                "store": {
                    "type": "LinkedServiceReference",
                    "referenceName": "linkedservicesKeyVault"
                },
                "secretName": "functions-host-key-default"
            }
        },
        "type": "AzureFunction"
    }
}
1

1 Answers

1
votes

There is a known Bug in Azure Data Factory and they are working on that. For now if you are creating the Azure Data Factory using .NET SDK then you'll need to set Headers like this in Azure Function Activity.

new AzureFunctionActivity
                {
                    Name = "CopyFromBlobToSnowFlake",
                    LinkedServiceName = new LinkedServiceReference(pipelineStructure.AzureFunctionLinkedService),
                    Method = "POST",
                    Body = body,
                    FunctionName = "LoadBlobsIntoSnowFlake",
                    Headers = new Dictionary<string, string>{ },
                    DependsOn = new List<ActivityDependency>
                    {
                        new ActivityDependency{
                            Activity = "CopyFromOPSqlServerToBlob",
                            DependencyConditions= new List<string>{"Succeeded" }
                        }
                    }
                }

If you are creating Azure Function Activity through UI then just update the description of Activity then Publish and Headers will automatically get Initialized.