Closed deepaksahu-perficient closed 2 years ago
Same issue here, on OSX. I tried a lot of things (removing the extension bundle cache, deinstalling/reinstalling core tools and more), nothing works.
This seems related to the extension bundle, probably being somehow corrupted. If I remove this from host.json
:
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[2.*, 3.0.0)"
}
and install the extensions I need manually, there's no error.
Let me know if you need help to pinpoint the issue, but it's really problematic as I could not find a way to recover from this other than the "manual install" workaround.
Also related: https://github.com/Azure/azure-functions-core-tools/issues/2364, https://github.com/Azure/azure-functions-core-tools/issues/2232, https://github.com/Azure/azure-functions-core-tools/issues/2350, https://github.com/Azure/azure-functions-core-tools/issues/2157, https://github.com/Azure/azure-functions-core-tools/issues/2115, https://github.com/Azure/azure-functions-core-tools/issues/1995, https://github.com/Azure/azure-functions-core-tools/issues/1924, https://github.com/Azure/azure-functions-core-tools/issues/2647
Here's the output of CLI_DEBUG=1 func start
Azure Functions Core Tools
Core Tools Version: 3.0.3477 Commit hash: 5fbb9a76fc00e4168f2cc90d6ff0afe5373afc6d (64-bit)
Function Runtime Version: 3.0.15584.0
Setting unsupported .NET environemt variables (empty string) is not implemented for this platform.
[2021-09-08T09:45:10.594Z] Cannot create directory for shared memory usage: /dev/shm/AzureFunctions
[2021-09-08T09:45:10.594Z] System.UnauthorizedAccessException: Access to the path '/dev/shm/AzureFunctions' is denied.
[2021-09-08T09:45:10.594Z] ---> System.IO.IOException: Permission denied
[2021-09-08T09:45:10.594Z] --- End of inner exception stack trace ---
[2021-09-08T09:45:10.594Z] at System.IO.FileSystem.CreateDirectory(String fullPath)
[2021-09-08T09:45:10.594Z] at System.IO.Directory.CreateDirectory(String path)
[2021-09-08T09:45:10.594Z] at Microsoft.Azure.WebJobs.Script.Workers.SharedMemoryDataTransfer.MemoryMappedFileAccessorUnix.GetValidDirectories() in D:\a\1\s\src\WebJobs.Script\Workers\SharedMemoryDataTransfer\MemoryMappedFileAccessorUnix.cs:line 175
System.ArgumentNullException: Value cannot be null. (Parameter 'provider')
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
at Azure.Functions.Cli.Actions.HostActions.StartHostAction.RunAsync() in D:\a\1\s\src\Azure.Functions.Cli\Actions\HostActions\StartHostAction.cs:line 344
at Azure.Functions.Cli.ConsoleApp.RunAsync[T](String[] args, IContainer container) in D:\a\1\s\src\Azure.Functions.Cli\ConsoleApp.cs:line 66
Note that the only extension bindings I use are CosmosDB bindings.
More findings, after activating the full logs in host.json
:
CLI_DEBUG=1 func start
Azure Functions Core Tools
Core Tools Version: 3.0.3477 Commit hash: 5fbb9a76fc00e4168f2cc90d6ff0afe5373afc6d (64-bit)
Function Runtime Version: 3.0.15584.0
Setting unsupported .NET environemt variables (empty string) is not implemented for this platform.
[2021-09-08T10:02:41.318Z] Cannot create directory for shared memory usage: /dev/shm/AzureFunctions
[2021-09-08T10:02:41.319Z] System.UnauthorizedAccessException: Access to the path '/dev/shm/AzureFunctions' is denied.
[2021-09-08T10:02:41.319Z] ---> System.IO.IOException: Permission denied
[2021-09-08T10:02:41.319Z] --- End of inner exception stack trace ---
[2021-09-08T10:02:41.319Z] at System.IO.FileSystem.CreateDirectory(String fullPath)
[2021-09-08T10:02:41.319Z] at System.IO.Directory.CreateDirectory(String path)
[2021-09-08T10:02:41.319Z] at Microsoft.Azure.WebJobs.Script.Workers.SharedMemoryDataTransfer.MemoryMappedFileAccessorUnix.GetValidDirectories() in D:\a\1\s\src\WebJobs.Script\Workers\SharedMemoryDataTransfer\MemoryMappedFileAccessorUnix.cs:line 175
[2021-09-08T10:02:41.319Z] Valid directories for shared memory usage:
[2021-09-08T10:02:41.358Z] Starting Rpc Initialization Service.
[2021-09-08T10:02:41.359Z] Initializing RpcServer
[2021-09-08T10:02:41.372Z] RpcServer initialized
[2021-09-08T10:02:41.373Z] Rpc Initialization Service started.
[2021-09-08T10:02:41.378Z] Startup operation 'f94e1ac9-f568-4678-b8ee-7c406fe8979c' with parent id '(null)' created.
[2021-09-08T10:02:41.384Z] Startup operation 'f94e1ac9-f568-4678-b8ee-7c406fe8979c' starting.
[2021-09-08T10:02:41.386Z] Building host: startup suppressed: 'False', configuration suppressed: 'False', startup operation id: 'f94e1ac9-f568-4678-b8ee-7c406fe8979c'
[2021-09-08T10:02:41.418Z] Host configuration applied.
[2021-09-08T10:02:41.420Z] Reading host configuration file '/Users/sinedied/projects/azure-cantina/api/host.json'
[2021-09-08T10:02:41.421Z] Host configuration file read:
[2021-09-08T10:02:41.421Z] {
[2021-09-08T10:02:41.421Z] "version": "2.0",
[2021-09-08T10:02:41.421Z] "logging": {
[2021-09-08T10:02:41.421Z] "logLevel": {
[2021-09-08T10:02:41.421Z] "default": "Debug"
[2021-09-08T10:02:41.421Z] },
[2021-09-08T10:02:41.421Z] "applicationInsights": {
[2021-09-08T10:02:41.421Z] "samplingSettings": {
[2021-09-08T10:02:41.421Z] "isEnabled": true,
[2021-09-08T10:02:41.421Z] "excludedTypes": "Request"
[2021-09-08T10:02:41.421Z] }
[2021-09-08T10:02:41.421Z] }
[2021-09-08T10:02:41.421Z] },
[2021-09-08T10:02:41.421Z] "extensionBundle": {
[2021-09-08T10:02:41.421Z] "id": "Microsoft.Azure.Functions.ExtensionBundle",
[2021-09-08T10:02:41.421Z] "version": "[2.*, 3.0.0)"
[2021-09-08T10:02:41.421Z] }
[2021-09-08T10:02:41.421Z] }
[2021-09-08T10:02:41.437Z] Loading functions metadata
[2021-09-08T10:02:41.439Z] Workers Directory set to: /usr/local/Cellar/azure-functions-core-tools@3/3.0.3477/workers
[2021-09-08T10:02:41.442Z] Found worker config: /usr/local/Cellar/azure-functions-core-tools@3/3.0.3477/workers/python/worker.config.json
[2021-09-08T10:02:41.454Z] EnvironmentVariable FUNCTIONS_WORKER_RUNTIME: node
[2021-09-08T10:02:41.454Z] FUNCTIONS_WORKER_RUNTIME set to node. Skipping WorkerConfig for language:python
[2021-09-08T10:02:41.454Z] Found worker config: /usr/local/Cellar/azure-functions-core-tools@3/3.0.3477/workers/java/worker.config.json
[2021-09-08T10:02:41.458Z] EnvironmentVariable FUNCTIONS_WORKER_RUNTIME: node
[2021-09-08T10:02:41.458Z] FUNCTIONS_WORKER_RUNTIME set to node. Skipping WorkerConfig for language:java
[2021-09-08T10:02:41.458Z] Found worker config: /usr/local/Cellar/azure-functions-core-tools@3/3.0.3477/workers/powershell/worker.config.json
[2021-09-08T10:02:41.460Z] EnvironmentVariable FUNCTIONS_WORKER_RUNTIME: node
[2021-09-08T10:02:41.460Z] FUNCTIONS_WORKER_RUNTIME set to node. Skipping WorkerConfig for language:powershell
[2021-09-08T10:02:41.461Z] Found worker config: /usr/local/Cellar/azure-functions-core-tools@3/3.0.3477/workers/node/worker.config.json
[2021-09-08T10:02:41.462Z] EnvironmentVariable FUNCTIONS_WORKER_RUNTIME: node
[2021-09-08T10:02:41.462Z] EnvironmentVariable FUNCTIONS_WORKER_RUNTIME_VERSION:
[2021-09-08T10:02:41.464Z] Added WorkerConfig for language: node
[2021-09-08T10:02:41.466Z] Reading functions metadata
[2021-09-08T10:02:41.481Z] 7 functions found
[2021-09-08T10:02:41.491Z] 7 functions loaded
[2021-09-08T10:02:41.496Z] Looking for extension bundle Microsoft.Azure.Functions.ExtensionBundle at /Users/sinedied/.azure-functions-core-tools/Functions/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle
[2021-09-08T10:02:41.497Z] 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
[2021-09-08T10:02:41.691Z] Downloading extension bundle from https://functionscdn.azureedge.net/public/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/2.6.1/Microsoft.Azure.Functions.ExtensionBundle.2.6.1_any-any.zip to /var/folders/35/klghsqh56t38rb25p6c63rjw0000gn/T/6f18c3b2-b9d1-4f78-9e5a-af9865ac99dc/Microsoft.Azure.Functions.ExtensionBundle.2.6.1.zip
[2021-09-08T10:04:21.707Z] Host startup operation 'f94e1ac9-f568-4678-b8ee-7c406fe8979c' was canceled.
[2021-09-08T10:04:21.708Z] Startup operation 'f94e1ac9-f568-4678-b8ee-7c406fe8979c' completed.
System.ArgumentNullException: Value cannot be null. (Parameter 'provider')
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
at Azure.Functions.Cli.Actions.HostActions.StartHostAction.RunAsync() in D:\a\1\s\src\Azure.Functions.Cli\Actions\HostActions\StartHostAction.cs:line 344
at Azure.Functions.Cli.ConsoleApp.RunAsync[T](String[] args, IContainer container) in D:\a\1\s\src\Azure.Functions.Cli\ConsoleApp.cs:line 66
[2021-09-08T10:04:55.303Z] Shuttingdown Rpc Channels Manager
[2021-09-08T10:04:55.306Z] Stopping host...
[2021-09-08T10:04:55.306Z] Active host changing from '(null)' to '(null)'.
[2021-09-08T10:04:55.308Z] Host shutdown completed.
[2021-09-08T10:04:55.312Z] Shutting down RPC server
[2021-09-08T10:04:55.345Z] Disposing MetricsEventManager
It seems the bundle downloading gets canceled (forced timeout?) and that probably may be the issue here as the looking at the extension folder nothing gets downloaded there.
I have a slow ADSL connection so downloading ~100Mo takes 2-3min in good days, but can go as far as ~10min. Not directly related, but it would be nice to have a download progress or at least a minimal user feedback during the download (I'll create a separate issue).
@sinedied Unrelated, where did you figure out CLI_DEBUG
? It doesn't seem to be documented anywhere, yet is also the only way to get a full stack trace when host startup fails (on a not-unrelated note, you just saved me hours of debugging)...
@IanKemp I found about CLI_DEBUG
by navigating through many github issues, and at one point this was suggested. Seems an internal flag, but a useful one!
@sinedied You mention above
and install the extensions I need manually, there's no error.
How do you find/list the extensions you need and install them manually? Thanks for your help.
I'm having the same issue, btw.
I didn't think MacOS supports shared memory in this linux-y way, correct?
@DustinReagan To install extension manually, you first have to remove the bundle entry from host.json
:
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[2.*, 3.0.0)"
}
Then you can use the func CLI to install what you need with func extenion install <extension_name>
or install all extensions with func extension install
. As for what to install, I usually simply use the binding names used in function.json
files, but you can also specify the NuGet packages directly.
@anthonychu Any news on this? This one is quite problematic and I've reproduced it many times (in a 30p workshop, about 20% ended up having this issue). I'm also quite confident that this is related to the extension bundle download, as I tried downloading the zip file manually (URL from logs) and unzipping it in the right folder fixed the issue.
@sinedied Please, can you tell me where you exactly extracted it? I'm extracting the zip right into C:\Users\{username}\.azure-functions-core-tools\Functions\ExtensionBundles\Microsoft.Azure.Functions.ExtensionBundle
(all files just right there.) But it is still trying to download the file...
UPDATE: After some experimentation, I found out where it should be extracted. Place it in C:\Users\{username}\.azure-functions-core-tools\Functions\ExtensionBundles\Microsoft.Azure.Functions.ExtensionBundle/{version}
. The version I got it from the file's name being downloaded
Example: for the file Microsoft.Azure.Functions.ExtensionBundle.2.8.4_any-any.zip
, I had to put it on C:\Users\{username}\.azure-functions-core-tools\Functions\ExtensionBundles\Microsoft.Azure.Functions.ExtensionBundle\2.8.4
. Thanks for the hints @sinedied
I think the error message Value cannot be null. (Parameter 'Provider')
is somewhat misleading. Perhaps the download needs a bit more exception handling to tell better what's going on. Another thing, I suppose the problem for me is because of some kind of timeout when downloading. My internet is poor, and the extension bundle sizes about 70 MB, which took me about 10 minutes to download.
I think the error message
Value cannot be null. (Parameter 'Provider')
is somewhat misleading. Perhaps the download needs a bit more exception handling to tell better what's going on. Another thing, I suppose the problem for me is because of some kind of timeout when downloading. My internet is poor, and the extension bundle sizes about 70 MB, which took me about 10 minutes to download.
I probably face similar issue, have never had this issue before, but I'm currently on a slow internet and can't download the bundle I'll try this out on a better connection to confirm this
UPD: switching to better internet helped, it seems there's some hardcoded timeout for downloading the extension bundle
@alfosua Thanks, this worked for me!
UPDATE: After some experimentation, I found out where it should be extracted. Place it in
C:\Users\{username}\.azure-functions-core-tools\Functions\ExtensionBundles\Microsoft.Azure.Functions.ExtensionBundle/{version}
. The version I got it from the file's name being downloadedExample: for the file
Microsoft.Azure.Functions.ExtensionBundle.2.8.4_any-any.zip
, I had to put it onC:\Users\{username}\.azure-functions-core-tools\Functions\ExtensionBundles\Microsoft.Azure.Functions.ExtensionBundle\2.8.4
. Thanks for the hints @sinedied
[2021-12-15T20:36:06.787Z] Looking for extension bundle Microsoft.Azure.Functions.ExtensionBundle at C:\Users\{username}\.azure-functions-core-tools\Functions\ExtensionBundles\Microsoft.Azure.Functions.ExtensionBundle
[2021-12-15T20:36:06.793Z] Found a matching extension bundle at C:\Users\{username}\.azure-functions-core-tools\Functions\ExtensionBundles\Microsoft.Azure.Functions.ExtensionBundle\2.8.4
[2021-12-15T20:36:06.819Z] Looking for extension bundle Microsoft.Azure.Functions.ExtensionBundle at C:\Users\{username}\.azure-functions-core-tools\Functions\ExtensionBundles\Microsoft.Azure.Functions.ExtensionBundle
[2021-12-15T20:36:06.823Z] Found a matching extension bundle at C:\Users\{username}\.azure-functions-core-tools\Functions\ExtensionBundles\Microsoft.Azure.Functions.ExtensionBundle\2.8.4
[2021-12-15T20:36:06.827Z] 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
[2021-12-15T20:36:07.377Z] Skipping bundle download since it already exists at path C:\Users\{username}\.azure-functions-core-tools\Functions\ExtensionBundles\Microsoft.Azure.Functions.ExtensionBundle\2.8.4
[2021-12-15T20:36:07.388Z] Loading extension bundle from C:\Users\{username}\.azure-functions-core-tools\Functions\ExtensionBundles\Microsoft.Azure.Functions.ExtensionBundle\2.8.4\bin
[2021-12-15T20:36:07.390Z] Script Startup resetting load context with base path: @'C:\Users\{username}\.azure-functions-core-tools\Functions\ExtensionBundles\Microsoft.Azure.Functions.ExtensionBundle\2.8.4\bin'.
@deepaksahu-perficient @sinedied Are you still facing this issue with the latest version of Core Tools V3 or V4?
Hi michaelpeng36, this issue is fixed with latest version of core tool
I am trying to run simple func app using ServiceBusTopicTrigger & below codes are auto created which i to have run
index.js module.exports = async function(context, mySbMsg) { context.log('JavaScript ServiceBus topic trigger function processed message', mySbMsg); };
function.json { "bindings": [ { "name": "mySbMsg", "type": "serviceBusTrigger", "direction": "in", "topicName": "len_sf_data", "subscriptionName": "len_sf_data_sub", "connection": "ESBServicesDev_SERVICEBUS" } ] }
host.json { "version": "2.0", "logging": { "applicationInsights": { "samplingSettings": { "isEnabled": true, "excludedTypes": "Request" } } }, "extensionBundle": { "id": "Microsoft.Azure.Functions.ExtensionBundle", "version": "[2.*, 3.0.0)" } }
But as i run, it gives error : Value cannot be null. (Parameter 'provider'). Interestingly the same piece of code was running fine earlier.
Below are the components information which have been used, Azure Functions Core Tools Core Tools Version: 3.0.3477 Commit hash: 5fbb9a76fc00e4168f2cc90d6ff0afe5373afc6d (64-bit) Function Runtime Version: 3.0.15584.0
Visual Studio Code Version: 1.58.2 (user setup) Commit: c3f126316369cd610563c75b1b1725e0679adfb3 Date: 2021-07-14T22:10:15.214Z Electron: 12.0.13 Chrome: 89.0.4389.128 Node.js: 14.16.0 V8: 8.9.255.25-electron.0 OS: Windows_NT x64 10.0.19042
npm@6.14.13 MS .Net SDK 5.0.301 (x64) Version : 5.3.121.27113
I have already tried to installation latest azure func core tools ( 3.0.3568) but while running it shows only 3.0.3477. Also cleared cache & file like npm cache clean --force, C:\Users[name]\AppData\Roaming\npm\
Kindly let me know if you need some more information on this.