Azure / Azure/azure-functions-core-tools

func templates list returns "Value cannot be null"

Open
#2,109 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
1.5k
Forks
498
Avg merge
4d 20h
Merged PRs (30d)
14

Description

This is what's happening:
```
forla@DESKTOP-PGDBNMB MINGW64 /d/workspace/flamingo-rtc/serverless (forlayo_167_timeline)
$ npm i -g azure-functions-core-tools
C:\Program Files\nodejs\azfun -> C:\Program Files\nodejs\node_modules\azure-functions-core-tools\lib\main.js
C:\Program Files\nodejs\azurefunctions -> C:\Program Files\nodejs\node_modules\azure-functions-core-tools\lib\main.js
C:\Program Files\nodejs\func -> C:\Program Files\nodejs\node_modules\azure-functions-core-tools\lib\main.js

> azure-functions-core-tools@2.7.2628 postinstall C:\Program Files\nodejs\node_modules\azure-functions-core-tools
> node lib/install.js

attempting to GET "https://functionscdn.azureedge.net/public/2.7.2628/Azure.Functions.Cli.win-x64.2.7.2628.zip"
[==================] Downloading Azure Functions Core Tools

Telemetry
---------
The Azure Functions Core tools collect usage data in order to help us improve your experience.
The data is anonymous and doesn't include any user specific or personal information. The data is collected by Microsoft.

You can opt-out of telemetry by setting the FUNCTIONS_CORE_TOOLS_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.

+ azure-functions-core-tools@2.7.2628
updated 1 package in 18.362s

forla@DESKTOP-PGDBNMB MINGW64 /d/workspace/flamingo-rtc/serverless (forlayo_167_timeline)
$ func templates list
Value cannot be null.
Parameter name: value

forla@DESKTOP-PGDBNMB MINGW64 /d/workspace/flamingo-rtc/serverless (forlayo_167_timeline)
$ export CLI_DEBUG=1

forla@DESKTOP-PGDBNMB MINGW64 /d/workspace/flamingo-rtc/serverless (forlayo_167_timeline)
$ func templates list
System.ArgumentNullException: Value cannot be null.
Parameter name: value
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at Azure.Functions.Cli.Common.TemplatesManager.GetTemplates() in D:\a\1\s\src\Azure.Functions.Cli\Common\TemplatesManager.cs:line 42
at Azure.Functions.Cli.Actions.LocalActions.ListTemplatesAction.RunAsync() in D:\a\1\s\src\Azure.Functions.Cli\Actions\LocalActions\ListTemplatesAction.cs:line 36
at Azure.Functions.Cli.ConsoleApp.RunAsync[T](String[] args, IContainer container) in D:\a\1\s\src\Azure.Functions.Cli\ConsoleApp.cs:line 66
```

As you can see the functions cli is recently installed and I am just trying to list the templates, but got an error all times. I had also enabled the CLI_DEBUG and apparently is something deserializing a json :S

Trying to create a function, I got same issue
```
forla@DESKTOP-PGDBNMB MINGW64 /d/workspace/flamingo-rtc/serverless (forlayo_167_timeline)
$ func new -l JavaScript -n Notes -t 'HTTP trigger'
System.ArgumentNullException: Value cannot be null.
Parameter name: value
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at Azure.Functions.Cli.Common.TemplatesManager.GetTemplates() in D:\a\1\s\src\Azure.Functions.Cli\Common\TemplatesManager.cs:line 42
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
```

Contributor guide

Open the contributing guide

Research direction

Start with Common/TemplatesManager.cs at line 42 and trace the template-loading path used by ListTemplatesAction.cs line 36 and CreateFunctionAction.cs line 78. Reproduce the failure with `func templates list` and `func new`, then verify both commands complete without the null-value exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.