Microsoft Azure Functions:价值“提供者” VS Code 生成的 Python 函数应用程序不能为 null

发布于 2025-01-20 14:49:15 字数 2417 浏览 4 评论 0原文

这是我第 n 次遇到此错误,但这是我第一次使用 Azure 上的 Python 函数。以前,我在使用基于 Java 的函数以及 Azure 上的 Spring Cloud Function 时也遇到过同样的问题。

我使用官方 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')

This is the nth time I am running into this error, but this time it's my first time with Python Functions on Azure. Previously I faced the same with Java based functions and also probably Spring Cloud Function on Azure.

I created a Python based Function application (with Blob Trigger) using all the defaults provided by the official VS Code extension (configuring appropriate connection string during setup). On attempting to run my functions app locally, it gives the following error (with --verbose flag):

[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')

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ゃ懵逼小萝莉 2025-01-27 14:49:15

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

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

[2022-04-11T10:04:26.131Z] 从 https://functionscdn.azureedge.net/public/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/2.8.4/Microsoft.Azure.Functions.ExtensionBundle.2.8.4_any-any.zip 到/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] 在 /Users/sbsatter/.azure-functions-core-tools/Functions/ExtensionBundles/Microsoft 中查找扩展包 Microsoft.Azure.Functions.ExtensionBundle。 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

:解决方法也应该适用于其他触发器。

Answering my own question on my workaround (not an actual solution I would say) since every few months I end up facing this error.

It appears to me that while downloading the extension bundle, it fails for some reason (or rather times out) which isn't clearly specified in the logs. I have retried for days but have had no success. Hence, I manually download the url for ExtensionBundle from these lines:

[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

and uncompress the zip, and place it in the directory mentioned in the following log:

[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

Afterwards, the function app just starts fine as you can observe from the following logs:

[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

This workaround should work for other triggers as well.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文