Open jeffhollan opened 4 years ago
can you try CLI_DEBUG=1 func new
and share the output? I can't repro this on linux
System.ArgumentNullException: Value cannot be null. (Parameter 'value') at Newtonsoft.Json.Utilities.ValidationUtils.ArgumentNotNull(Object value, String parameterName) at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings) at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value) at Azure.Functions.Cli.Common.TemplatesManager.GetTemplates() in D:\a\1\s\src\Azure.Functions.Cli\Common\TemplatesManager.cs:line 47 at Azure.Functions.Cli.Actions.LocalActions.CreateFunctionAction.RunAsync() in D:\a\1\s\src\Azure.Functions.Cli\Actions\LocalActions\CreateFunctionAction.cs:line 78 at Azure.Functions.Cli.ConsoleApp.RunAsync[T](String[] args, IContainer container) in D:\a\1\s\src\Azure.Functions.Cli\ConsoleApp.cs:line 66
I see the same error on a function with worker runtime dotnet. The error disappears after removing these lines from host.json
"extensionBundle": { "id": "Microsoft.Azure.Functions.ExtensionBundle", "version": "[1.*, 2.0.0)" }
Using azure-cli-core-tools version 3.0.2106
any updates on this issue, because i am facing that too.
Hi @soninaren ,
I'm also facing this issue now Value cannot be null. (Parameter 'value')
.
Using CoreTools 3.0.2534
@Hazhzeng. This is very likely caused by incomplete download of extension bundle
For Windows:
C:\Users\{user}\AppData\Local\Temp\Functions\ExtensionBundles
For Linux:
find /private/var -name "ExtensionBundles" -print 2>/dev/null
(from https://github.com/Azure/azure-functions-core-tools/issues/1924#issuecomment-609582338)This happens frequently enough and it's not clear how to resolve it. I'd love to see if we can automatically detect this and fix it. #1999
@anthonychu you are correct about the frequency of the issue. The root cause has been very difficult to detect. That being said we can definitely add some defensive measures to make sure the bundle is fully downloaded before we move ahead.
@soninaren I think it is related to slow internet connection. As it stores extension bundle in temp folders of OS system, it will fetch every time on new session of OS. So if there is a slow connection than this issue happens. I already confirmed this.
Temporary solution for Linux users only, needs to do it on every session or when error occurs. For this you have to just download ExtensionBundles only one time. Download it from here:- https://functionscdn.azureedge.net/public/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/1.1.1/Microsoft.Azure.Functions.ExtensionBundle.1.1.1.zip
Now follow this steps:-
mkdir -p /tmp/Functions/ExtensionBundles
cp -R ./Microsoft.Azure.Functions.ExtensionBundle /tmp/Functions/ExtensionBundles/
func new
or any other command, they will run with ease.I think this solution apply to windows as well but obviously there must be different path to temp folder and structure.
@daxay, Core tools is only supposed to download a bundle if a newer version of extension bundle is available. Otherwise it is supposed to use the bundle that is already downloaded to the temp folder. Checking for a newer version of bundle should only need to download a few bytes.
I suspect the combination of the following 2 issues are causing this.
I am going to try and optimize bundle download process to do the following:
@soninaren , I agreed with you about the Core tools behaviour on partially download.
@sethjuarez Is running into this as well. On Windows.
❯ func new
System.ArgumentNullException: Value cannot be null. (Parameter 'value')
at Newtonsoft.Json.Utilities.ValidationUtils.ArgumentNotNull(Object value, String parameterName)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value)
at Azure.Functions.Cli.Common.TemplatesManager.GetTemplates() in D:\a\1\s\src\Azure.Functions.Cli\Common\TemplatesManager.cs:line 48
at Azure.Functions.Cli.Actions.LocalActions.CreateFunctionAction.RunAsync() in D:\a\1\s\src\Azure.Functions.Cli\Actions\LocalActions\CreateFunctionAction.cs:line 78
at Azure.Functions.Cli.ConsoleApp.RunAsync[T](String[] args, IContainer container) in D:\a\1\s\src\Azure.Functions.Cli\ConsoleApp.cs:line 66
Got a copy of @sethjuarez's C:\Users\{user}\AppData\Local\Temp\Functions\ExtensionBundles
folder (thanks!), it's missing files in the bin
folder. It only has the first 5 files alphabetically, which indeed is consistent with an interrupted unzip.
@soninaren Is it possible to write a file at the end of extraction to signal that everything unzipped properly, and use it to decided whether to re-download?
Writing file at the end of extraction would be tricky. It would be hard to make the operation atomic and we might end up seeing that file anyway. We can introduce a manifest file that lists all the files and their relative paths in the bundle and verify that all files in the bundle are present including the manifest file. We can explicitly trigger bundle download and verification before host start in core tools.
I am having this issue in production on Azure. My functions work fine run locally but on Azure I get:
2020-08-10T12:31:41.081 [Error] Executed 'Functions.ImportProduct' (Failed, Id=52d40125-f29c-42af-aceb-c5aa4d0d93b5, Duration=1949ms)
Value cannot be null. (Parameter 'key')
How can I remove the ExtensionsBundle cache on live? Do I need to just do a new build/release and hope for the best?
@richardweaver Took a look at the logs on our side. Seeing errors about durableClient
is invalid. Can you try it with orchestrationClient
instead? durableClient
is specific to Durable Functions v2, which will be available in extension bundles v2. It'll be available soon and we'll update our documentation on how to upgrade your app to take advantage of it.
/cc @davidmrdavid
@anthonychu Thanks for the pointer. I thought it might be related to the extension bundle issue after some googling around.
However, I removed all the durable functions pieces completely and after deployment it worked fine for a few minutes and then the same error started appearing. Value cannot be null. (Parameter 'key')
/cc @dhardie
@richardweaver Can you share the function.json from your functions having the issue?
@mathewc Looks like you might have recently added a null check to address this (https://github.com/Azure/azure-functions-host/pull/6478). Can you share what can cause this problem and any workarounds?
@anthonychu Sure:
{
"bindings": [
{
"name": "product",
"type": "queueTrigger",
"direction": "in",
"queueName": "importproduct",
"connection": "AzureWebJobsStorage"
},
{
"name": "existing",
"type": "cosmosDB",
"direction": "in",
"databaseName": "%DatabaseName%",
"collectionName": "%ProductsContainer%",
"connectionStringSetting": "CosmosDBConnectionString",
"id": "{No}",
"partitionKey": "product"
},
{
"name": "$return",
"type": "cosmosDB",
"direction": "out",
"databaseName": "%DatabaseName%",
"collectionName": "%ProductsContainer%",
"connectionStringSetting": "CosmosDBConnectionString"
}
]
}
Just to follow up on this, I can't even create a new function in a fresh, empty project:
C:\Users\weaverr\Projects>func init func-skeleton-3
Use the up/down arrow keys to select a worker runtime:node
Use the up/down arrow keys to select a language:javascript
Writing package.json
Writing .gitignore
Writing host.json
Writing local.settings.json
Writing C:\Users\weaverr\Projects\func-skeleton-3\.vscode\extensions.json
C:\Users\weaverr\Projects>cd func-skeleton-3
C:\Users\weaverr\Projects\func-skeleton-3>func new
Value cannot be null. (Parameter 'value')
Hi @richardweaver, as Anthony mentioned, to mitigate this issue, you may want to remove the folders in %appdata%/../Local/Temp/Functions
. The core tools cache a copy of ExtensionBundles in there. Clearing out the cache will initialize a redownload on the next func command.
did
func init
on a container and set JavaScript. When I sayfunc new
I get this error. I tried passing in flags for language, template, etc. and nothings eems to workMac
/cc @ahmedelnably