Microsoft Azure Functions:值 'provider' 不能为空,VS 代码生成 Python Functions App

Microsoft Azure Functions: value 'provider' cannot be null with VS Code generated Python Functions App

这是我第 n 次 运行 遇到此错误,但这是我第一次在 Azure 上使用 Python Functions。以前我遇到过同样的基于 Java 的功能,也可能 Spring Azure 上的云功能。

我使用官方 VS Code 扩展提供的所有默认设置(在安装过程中配置适当的连接字符串)创建了一个基于 Python 的函数应用程序(带有 Blob 触发器)。尝试在本地 运行 我的函数应用程序时,出现以下错误(带有 --verbose 标志):

[2022-04-11T10:04:25.432Z] Host configuration file read:
[2022-04-11T10:04:25.432Z] {
[2022-04-11T10:04:25.432Z]   "version": "2.0",
[2022-04-11T10:04:25.432Z]   "logging": {
[2022-04-11T10:04:25.432Z]     "applicationInsights": {
[2022-04-11T10:04:25.432Z]       "samplingSettings": {
[2022-04-11T10:04:25.432Z]         "isEnabled": true,
[2022-04-11T10:04:25.432Z]         "excludedTypes": "Request"
[2022-04-11T10:04:25.432Z]       }
[2022-04-11T10:04:25.432Z]     }
[2022-04-11T10:04:25.432Z]   },
[2022-04-11T10:04:25.432Z]   "extensionBundle": {
[2022-04-11T10:04:25.432Z]     "id": "Microsoft.Azure.Functions.ExtensionBundle",
[2022-04-11T10:04:25.432Z]     "version": "[2.*, 3.0.0)"
[2022-04-11T10:04:25.432Z]   }
[2022-04-11T10:04:25.432Z] }
[2022-04-11T10:04:25.456Z] Loading functions metadata
[2022-04-11T10:04:25.483Z] FUNCTIONS_WORKER_RUNTIME set to python. Skipping WorkerConfig for language:java
[2022-04-11T10:04:25.485Z] FUNCTIONS_WORKER_RUNTIME set to python. Skipping WorkerConfig for language:powershell
[2022-04-11T10:04:25.486Z] FUNCTIONS_WORKER_RUNTIME set to python. Skipping WorkerConfig for language:node
[2022-04-11T10:04:25.487Z] Reading functions metadata
[2022-04-11T10:04:25.503Z] 1 functions found
[2022-04-11T10:04:25.516Z] 1 functions loaded
[2022-04-11T10:04:25.522Z] Looking for extension bundle Microsoft.Azure.Functions.ExtensionBundle at /Users/sbsatter/.azure-functions-core-tools/Functions/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle
[2022-04-11T10:04:25.525Z] Fetching information on versions of extension bundle Microsoft.Azure.Functions.ExtensionBundle available on https://functionscdn.azureedge.net/public/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/index.json
[2022-04-11T10:04:26.131Z] Downloading extension bundle from https://functionscdn.azureedge.net/public/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/2.8.4/Microsoft.Azure.Functions.ExtensionBundle.2.8.4_any-any.zip to /var/folders/7b/8bk0vwqx1yb9fvfdlj0qnlwh0000gn/T/dd0cf939-8efb-423e-ba0f-abb0027874e6/Microsoft.Azure.Functions.ExtensionBundle.2.8.4.zip
Value cannot be null. (Parameter 'provider')

回答我自己关于解决方法的问题(不是我会说的实际解决方案),因为每隔几个月我就会遇到这个错误。

在我看来,在下载扩展包时,它由于某种原因(或者更确切地说是超时)而失败,这在日志中没有明确说明。我已经重试了几天,但没有成功。因此,我手动从这些行下载ExtensionBundle的url:

[2022-04-11T10:04:26.131Z] Downloading extension bundle from https://functionscdn.azureedge.net/public/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/2.8.4/Microsoft.Azure.Functions.ExtensionBundle.2.8.4_any-any.zip to /var/folders/7b/8bk0vwqx1yb9fvfdlj0qnlwh0000gn/T/dd0cf939-8efb-423e-ba0f-abb0027874e6/Microsoft.Azure.Functions.ExtensionBundle.2.8.4.zip

解压缩 zip,然后将其放在以下日志中提到的目录中:

[2022-04-11T10:04:25.522Z] Looking for extension bundle Microsoft.Azure.Functions.ExtensionBundle at /Users/sbsatter/.azure-functions-core-tools/Functions/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle

之后,函数应用程序正常启动,您可以从以下日志中观察到:

[2022-04-11T10:16:44.797Z] Looking for extension bundle Microsoft.Azure.Functions.ExtensionBundle at /Users/sbsatter/.azure-functions-core-tools/Functions/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle
[2022-04-11T10:16:44.800Z] Found a matching extension bundle at /Users/sbsatter/.azure-functions-core-tools/Functions/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/2.8.4
[2022-04-11T10:16:44.802Z] Fetching information on versions of extension bundle Microsoft.Azure.Functions.ExtensionBundle available on https://functionscdn.azureedge.net/public/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/index.json
[2022-04-11T10:16:45.076Z] Skipping bundle download since it already exists at path /Users/sbsatter/.azure-functions-core-tools/Functions/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/2.8.4

此解决方法也适用于其他触发器。