简体   繁体   English

从数据工厂管道触发器调用azure函数时出错

[英]Error calling the azure function from data factory pipeline trigger

I am calling an http triggered Azure function app in data factory pipeline using ADF function activity. 我正在使用ADF函数活动在数据工厂管道中调用http触发的Azure函数应用。 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. 还有什么方法可以查看通过ADF中的函数活动调用函数应用程序时生成的URL。

I have tried calling same function app using web activity in ADF and that is working fine in both debug and trigger mode. 我尝试使用ADF中的网络活动调用同一功能的应用程序,并且在调试和触发模式下均能正常工作。

Linked service code for Azure function 用于Azure功能的链接服务代码

{
    "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"
    }
}

There is a known Bug in Azure Data Factory and they are working on that. Azure数据工厂中存在一个已知的Bug,他们正在对此进行工作。 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. 现在,如果要使用.NET SDK创建Azure数据工厂,则需要在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. 如果要通过UI创建Azure Function活动,则只需更新活动的说明,然后发布和标题将自动获得初始化。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM