azure-functions-host: If downloading the extension bundle takes too long, the runtime doesn't start properly

If you’re on a slow Internet connection such that the extension bundle can’t download within about 2 minutes, then the runtime fails.

Manually downloading the extension bundle (nearly 5 minutes on my connection) and expanding it where the ExtensionBundleManager looks for it works around the issue.

Console logs:

[hostname]:[project] [username]$ func start

                  %%%%%%
                 %%%%%%
            @   %%%%%%    @
          @@   %%%%%%      @@
       @@@    %%%%%%%%%%%    @@@
     @@      %%%%%%%%%%        @@
       @@         %%%%       @@
         @@      %%%       @@
           @@    %%      @@
                %%
                %

Azure Functions Core Tools (2.7.1585 Commit hash: 9a2b7239b937148e3b76e6f7999798629a82134a)
Function Runtime Version: 2.0.12641.0
[9/19/19 8:14:17 PM] Building host: startup suppressed:False, configuration suppressed: False
[9/19/19 8:14:17 PM] Looking for extension bundle Microsoft.Azure.Functions.ExtensionBundle at /var/folders/pl/qgvhtxwx7153kf2c8y9bc8kw0000gn/T/Functions/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle
[9/19/19 8:14:17 PM] 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
[9/19/19 8:14:18 PM] Downloading extension bundle from https://functionscdn.azureedge.net/public/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/1.0.0/Microsoft.Azure.Functions.ExtensionBundle.1.0.0.zip to /var/folders/pl/qgvhtxwx7153kf2c8y9bc8kw0000gn/T/5d2fd1c0-d8f7-4ced-82c9-93cf0de7f0bc/Microsoft.Azure.Functions.ExtensionBundle.1.0.0.zip
Hosting environment: Production
Content root path: /Users/[username]/[project]
Now listening on: http://0.0.0.0:7071
Application started. Press Ctrl+C to shut down.
Value cannot be null.
Parameter name: provider
Application is shutting down...
[9/19/19 8:16:31 PM] Stopping host...
[9/19/19 8:16:31 PM] Host shutdown completed.

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Comments: 15 (4 by maintainers)

Most upvoted comments

Here were my workaround steps. This was on a Mac but the concepts should carry over to other platforms.

If func host start fails to get rolling and you see in the console messages about downloading the extension bundle and then two minutes later that the provider cannot be null, you probably need to manually download the extension bundle.

[9/19/19 8:14:17 PM] Looking for extension bundle Microsoft.Azure.Functions.ExtensionBundle at /var/folders/pl/qgvhtxwx7153kf2c8y9bc8kw0000gn/T/Functions/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle

...

[9/19/19 8:14:18 PM] Downloading extension bundle from https://functionscdn.azureedge.net/public/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/1.0.0/Microsoft.Azure.Functions.ExtensionBundle.1.0.0.zip to /var/folders/pl/qgvhtxwx7153kf2c8y9bc8kw0000gn/T/5d2fd1c0-d8f7-4ced-82c9-93cf0de7f0bc/Microsoft.Azure.Functions.ExtensionBundle.1.0.0.zip
Value cannot be null.
Parameter name: provider
Application is shutting down...
[9/19/19 8:16:31 PM] Stopping host...
[9/19/19 8:16:31 PM] Host shutdown completed.
  1. Download the file referenced in the console logs (look for Downloading extension bundle)
  2. Expand the .zip file
  3. Make the directory referenced in the console logs (look for Looking for extension bundle)
  4. Make a folder for the version number (1.0.0 in the example)
  5. Move the contents of the .zip file into the version number folder
  6. func host start again

Having same issue. Located in Japan. Attempts to hit https://functionscdn.azureedge.net/public/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/1.1.1/Microsoft.Azure.Functions.ExtensionBundle.1.1.1.zip time out after like 10 seconds and app just crashes:

A host error has occurred during startup operation '6ff53f3e-6f07-451c-98ac-808c0e6508f0'.
System.Net.Http: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
System.Private.CoreLib: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
Value cannot be null.
Parameter name: provider
Application is shutting down...

Same issue here. I tried the workaround by @Programmerman1 however it didn’t quite work (System.Private.CoreLib: The file …dll already exists), but I noticed something. It seems the download from azureedge.net CDN goes very, very slow, for some reason. I think it just times out and that’s why I end up getting the error when running func host start.

Just out of curiosity I tried downloading it using a VPN connected to a different country and download was blazing fast (less than a second) and the function worked fine. So it’s probably some network issues for the azureedge CDN in my region (East Asia).

However, what I don’t really understand is why everyday I run func host start and it needs to re-download the same bundle version… I would think the same one from a few hours ago should still be valid?

Well I deleted the following from host.json and it started working locally.

  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[1.*, 2.0.0)"
  }

@mrpassiontea Can you remove the extension bundle section from host.json and try again? By Removing bundle configuration the extension bundle download will not happen. That should help you isolate the issue.