azure-functions-core-tools icon indicating copy to clipboard operation
azure-functions-core-tools copied to clipboard

func kubernetes deploy: System.NullReferenceException thrown by KedaV2Resource.GetDurableScalar

Open cloudydemos opened this issue 2 years ago • 2 comments

I am trying to deploy a KEDA Function for the first time just following the docs but am getting an exception.

Steps I followed (Ubuntu 18.04.6 LTS VM with az and docker installed, kubectl configured):

  1. sudo apt-get install azure-functions-core-tools-4
  2. func kubernetes install --namespace keda
  3. sudo snap install dotnet-sdk --classic
  4. git clone https://github.com/cloudydemos/flightaware.git
  5. cd flightaware/Functions
  6. (Manually create a local local.settings.json file)
  7. func kubernetes deploy --name flightaware-functions --registry cloudyflightaware.azurecr.io --image-name flightaware-functions:latest --dry-run --debug

Result:

dotnet build --output bin/output System.NullReferenceException: Object reference not set to an instance of an object. at Azure.Functions.Cli.Kubernetes.KEDA.V2.KedaV2Resource.GetDurableScalar(JObject hostJson)+MoveNext() in D:\a\1\s\src\Azure.Functions.Cli\Kubernetes\KEDA\V2\KedaV2Resource.cs:line 59 at System.Linq.Enumerable.SelectManySingleSelectorIterator2.MoveNext() at YamlDotNet.Serialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseList[TContext](IObjectDescriptor value, IObjectGraphVisitor1 visitor, TContext context, Stack1 path) at YamlDotNet.Serialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseObject[TContext](IObjectDescriptor value, IObjectGraphVisitor1 visitor, TContext context, Stack1 path) at YamlDotNet.Serialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.Traverse[TContext](Object name, IObjectDescriptor value, IObjectGraphVisitor1 visitor, TContext context, Stack1 path) at YamlDotNet.Serialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseProperties[TContext](IObjectDescriptor value, IObjectGraphVisitor1 visitor, TContext context, Stack1 path) at YamlDotNet.Serialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseObject[TContext](IObjectDescriptor value, IObjectGraphVisitor1 visitor, TContext context, Stack1 path) at YamlDotNet.Serialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.Traverse[TContext](Object name, IObjectDescriptor value, IObjectGraphVisitor1 visitor, TContext context, Stack1 path) at YamlDotNet.Serialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseProperties[TContext](IObjectDescriptor value, IObjectGraphVisitor1 visitor, TContext context, Stack1 path) at YamlDotNet.Serialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseObject[TContext](IObjectDescriptor value, IObjectGraphVisitor1 visitor, TContext context, Stack1 path) at YamlDotNet.Serialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.Traverse[TContext](Object name, IObjectDescriptor value, IObjectGraphVisitor1 visitor, TContext context, Stack1 path) at YamlDotNet.Serialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.YamlDotNet.Serialization.IObjectGraphTraversalStrategy.Traverse[TContext](IObjectDescriptor graph, IObjectGraphVisitor1 visitor, TContext context) at YamlDotNet.Serialization.SerializerBuilder.ValueSerializer.SerializeValue(IEmitter emitter, Object value, Type type) at YamlDotNet.Serialization.Serializer.EmitDocument(IEmitter emitter, Object graph, Type type) at YamlDotNet.Serialization.Serializer.Serialize(IEmitter emitter, Object graph) at YamlDotNet.Serialization.Serializer.Serialize(TextWriter writer, Object graph) at Azure.Functions.Cli.Kubernetes.KubernetesHelper.SerializeResources(IEnumerable`1 resources, OutputSerializationOptions outputFormat) in D:\a\1\s\src\Azure.Functions.Cli\Kubernetes\KubernetesHelpers.cs:line 491 at Azure.Functions.Cli.Actions.KubernetesActions.KubernetesDeployAction.RunAsync() in D:\a\1\s\src\Azure.Functions.Cli\Actions\KubernetesActions\KubernetesDeployAction.cs:line 152 at Azure.Functions.Cli.ConsoleApp.RunAsync[T](String[] args, IContainer container) in D:\a\1\s\src\Azure.Functions.Cli\ConsoleApp.cs:line 64

cloudydemos avatar Apr 08 '22 22:04 cloudydemos

I am also getting this exact error message. Has anything been discovered on this since? It has only just started happening on one of my durable function containers. I'll revert to the older version and if the Azure Function Core Tools runs OK on that will try and work out the difference.

SWGAnthonyClark avatar Jul 01 '22 16:07 SWGAnthonyClark

The reason this error message was appearing for me, was that the durable functions storage settings were removed from the host.json file. Once I put it back this message went away and it deployed properly.

"extensions": { "durableTask": { "storageProvider": { "type": "mssql", "connectionStringName": "SQLDB_Connection", "taskEventLockTimeout": "00:02:00", "createDatabaseIfNotExists": true } }

SWGAnthonyClark avatar Jul 04 '22 15:07 SWGAnthonyClark