azure 如何解决“Field 'exists' failed with error in ADF”错误?

luaexgnf  于 2023-08-07  发布在  其他
关注(0)|答案(1)|浏览(113)

有一个从FTP读取文件的管道,我使用了“获取元数据”活动来实现这一点。我有一个数组类型的变量,它包含所有预期的文件。我已经遍历了这个变量,并使用了if条件,检查文件是否存在。有时,代码运行没有任何问题,但有时它会抛出下面的错误。
字段“exists”失败,出现错误:'Type=System.Net.WebException,Message=System error.,Source=System,''Type=System.Net.InternalException,Message=System error.,Source=System,'.


的数据



JSON:

{
"name": "test1",
"properties": {
    "activities": [
        {
            "name": "File availability summary",
            "description": "Send File not found alert mail",
            "type": "WebActivity",
            "dependsOn": [
                {
                    "activity": "avlFiles_final",
                    "dependencyConditions": [
                        "Succeeded"
                    ]
                }
            ],
            "policy": {
                "timeout": "0.12:00:00",
                "retry": 0,
                "retryIntervalInSeconds": 30,
                "secureOutput": false,
                "secureInput": false
            },
            "userProperties": [],
            "typeProperties": {
                "url": "<Logic app url>",
                "method": "POST",
                "body": {
                    "value": "@variables('avlfiles_final')",
                    "type": "Expression"
                }
            }
        },
        {
            "name": "ForEach Expected Files",
            "type": "ForEach",
            "dependsOn": [
                {
                    "activity": "Intialize cntr to 1 for SNo",
                    "dependencyConditions": [
                        "Succeeded"
                    ]
                }
            ],
            "userProperties": [],
            "typeProperties": {
                "items": {
                    "value": "@variables('expectedFiles')",
                    "type": "Expression"
                },
                "activities": [
                    {
                        "name": "Metadata of FTP",
                        "description": "get metadata of folder in FTP",
                        "type": "GetMetadata",
                        "dependsOn": [],
                        "policy": {
                            "timeout": "7.00:00:00",
                            "retry": 0,
                            "retryIntervalInSeconds": 30,
                            "secureOutput": false,
                            "secureInput": false
                        },
                        "userProperties": [],
                        "typeProperties": {
                            "dataset": {
                                "referenceName": "PartnerHub_FTP2_CopyActivity_prr_filename",
                                "type": "DatasetReference",
                                "parameters": {
                                    "filename": {
                                        "value": "@item()",
                                        "type": "Expression"
                                    }
                                }
                            },
                            "fieldList": [
                                "exists"
                            ],
                            "storeSettings": {
                                "type": "FtpReadSettings",
                                "recursive": true,
                                "enablePartitionDiscovery": false,
                                "useBinaryTransfer": true,
                                "disableChunking": false
                            },
                            "formatSettings": {
                                "type": "DelimitedTextReadSettings"
                            }
                        }
                    },
                    {
                        "name": "Check if file exists",
                        "description": "if exists, append to variable 'avlFiles' as available along with file name, otherwise 'Unavailable'",
                        "type": "IfCondition",
                        "dependsOn": [
                            {
                                "activity": "Metadata of FTP",
                                "dependencyConditions": [
                                    "Succeeded"
                                ]
                            }
                        ],
                        "userProperties": [],
                        "typeProperties": {
                            "expression": {
                                "value": "@activity('Metadata of FTP').output.exists",
                                "type": "Expression"
                            },
                            "ifFalseActivities": [
                                {
                                    "name": "Append avlFiles with Unavailable files",
                                    "type": "AppendVariable",
                                    "dependsOn": [],
                                    "userProperties": [],
                                    "typeProperties": {
                                        "variableName": "avlFiles",
                                        "value": {
                                            "value": "@json(concat('{','\"S.NO\":',variables('cntr'),',\"File Name\":\"',item(),'\",\"File Availability in FTP\":\"Unavailable\"}'))",
                                            "type": "Expression"
                                        }
                                    }
                                }
                            ],
                            "ifTrueActivities": [
                                {
                                    "name": "Append avlFiles with available files",
                                    "type": "AppendVariable",
                                    "dependsOn": [],
                                    "userProperties": [],
                                    "typeProperties": {
                                        "variableName": "avlFiles",
                                        "value": {
                                            "value": "@json(concat('{','\"S.NO\":',variables('cntr'),',\"File Name\":\"',item(),'\",\"File Availability in FTP\":\"Available\"}'))",
                                            "type": "Expression"
                                        }
                                    }
                                }
                            ]
                        }
                    },
                    {
                        "name": "increment and store in temp",
                        "type": "SetVariable",
                        "dependsOn": [
                            {
                                "activity": "Check if file exists",
                                "dependencyConditions": [
                                    "Succeeded"
                                ]
                            }
                        ],
                        "policy": {
                            "secureOutput": false,
                            "secureInput": false
                        },
                        "userProperties": [],
                        "typeProperties": {
                            "variableName": "tmp",
                            "value": {
                                "value": "@string(add(int(variables('cntr')),1))",
                                "type": "Expression"
                            }
                        }
                    },
                    {
                        "name": "store temp to counter",
                        "type": "SetVariable",
                        "dependsOn": [
                            {
                                "activity": "increment and store in temp",
                                "dependencyConditions": [
                                    "Succeeded"
                                ]
                            }
                        ],
                        "policy": {
                            "secureOutput": false,
                            "secureInput": false
                        },
                        "userProperties": [],
                        "typeProperties": {
                            "variableName": "cntr",
                            "value": {
                                "value": "@variables('tmp')",
                                "type": "Expression"
                            }
                        }
                    }
                ]
            }
        },
        {
            "name": "avlFiles_final",
            "description": "",
            "type": "SetVariable",
            "dependsOn": [
                {
                    "activity": "ForEach Expected Files",
                    "dependencyConditions": [
                        "Succeeded"
                    ]
                }
            ],
            "policy": {
                "secureOutput": false,
                "secureInput": false
            },
            "userProperties": [],
            "typeProperties": {
                "variableName": "avlfiles_final",
                "value": {
                    "value": "@{variables('avlFiles')}",
                    "type": "Expression"
                }
            }
        },
        {
            "name": "Initialize cntr to 1 for SNo",
            "type": "SetVariable",
            "dependsOn": [],
            "policy": {
                "secureOutput": false,
                "secureInput": false
            },
            "userProperties": [],
            "typeProperties": {
                "variableName": "cntr",
                "value": "1"
            }
        }
    ],
    "variables": {
        "expectedFiles": {
            "type": "Array",
            "defaultValue": [
                "@{concat('FILE1.', '20230713', '.1.csv')}",
                "@{concat('FILE2.', '20230713', '.1.csv')}",
                "@{concat('FILE3.', '20230713', '.1.csv')}",
                "@{concat('FILE4.', '20230713', '.1.csv')}"
            ]
        },
        "avlFiles": {
            "type": "Array"
        },
        "avlfiles_final": {
            "type": "String"
        },
        "cntr": {
            "type": "String"
        },
        "tmp": {
            "type": "String"
        }
    },
    "annotations": [],
    "lastPublishTime": "2023-07-25T19:45:49Z"
},
"type": "Microsoft.DataFactory/factories/pipelines"

字符串
}
有人能告诉我为什么会这样吗?

bz4sfanl

bz4sfanl1#

我在我的环境中尝试了相同的JSON,它对我来说工作得很好。


的数据
根据您的要求,您要生成序列号沿着其他密钥。要获取递增序列号,请确保选中Foreach中的Sequential



在获取Meta数据活动中遇到错误时,请尝试以下故障排除步骤来解决它。

  • 检查链接服务的连接,并在发布后在另一个管道中尝试相同的管道JSON。
  • 检查其他Get Meta data活动属性(如sizestructure)的结果是否相同(检查时仅传递这些属性的现有文件名)。

如果错误仍然存在,那么最好提出一个Support ticket,以便对此问题进行更深入的调查。

相关问题