繁体   English   中英

Microsoft Azure 函数:值“提供者”不能是 null,VS 代码生成 Python 函数应用程序

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

这是我第 n 次遇到此错误,但这次是我第一次在 Azure 上使用 Python 函数。之前我遇到过基于 Java 的函数,也可能是 Spring Cloud Function 在 883584787.6064 上

我创建了一个基于 886982359588 的 Python 应用程序(带有 Blob 触发器),使用了官方 VS 代码扩展提供的所有默认设置(在安装过程中配置适当的连接字符串)。 尝试在本地运行我的函数应用程序时,出现以下错误(带有 --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] 从https 下载扩展包://functionscdn.azureedge.net/public/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/2.8.4/Microsoft.Azure.ExtensionFunctions.ExtensionBundle 2.8.4_any-any.zip to/var/folders/7b/8bk0vwqx1yb9fvfdlj0qnlj0qnlj0qnlj0qnlwhlwh/t/dd0cf939-8efb-423e

解压 zip并将其放在以下日志中提到的目录中:

[2022-04-11T10:04:25.522Z] 在/Users/sbsatter/.azure-functions-core-tools/Functions/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle寻找扩展包 Microsoft.Azure.Functions.ExtensionBundle

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

[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

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

暂无
暂无

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

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