Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: data-source-files report Unhandled exception. System.AggregateException: One or more errors occurred. (Object reference not set to an instance of an object.) #2480

Open
1 task done
crushonme opened this issue Nov 27, 2024 · 0 comments
Labels
bug Something isn't working triage issues to be triaged
Milestone

Comments

@crushonme
Copy link

What happened?

When I use data-source-files to reference two configuration file, it report Unhandled exception. System.AggregateException: One or more errors occurred. (Object reference not set to an instance of an object.)

top level configuration file is as below. I have used "dab validate" command to validate these two child configuration and there is no error. And I have confirmed that Entity names are unique across all configuration files.

{
  "$schema": "https://github.com/Azure/data-api-builder/releases/download/v1.2.14/dab.draft.schema.json",
  "data-source-files":[
    "dab-config-local.json", 
    "dab-config-azsqldb.json"
  ],
  "runtime": {
    "rest": {
      "enabled": true,
      "path": "/api",
      "request-body-strict": true
    },
    "graphql": {
      "enabled": true,
      "path": "/graphql",
      "allow-introspection": true
    },
    "host": {
      "cors": {
        "origins": [],
        "allow-credentials": false
      },
      "authentication": {
        "provider": "StaticWebApps"
      },
      "mode": "development"
    }
  }
}

Full error log

dab validate -c dab-config-multi.json
Information: Microsoft.DataApiBuilder 1.2.14
Information: User provided config file: dab-config-multi.json
Information: Validating config file: dab-config-multi.json
Loading config file from dab-config-multi.json.
Unhandled exception. System.AggregateException: One or more errors occurred. (Object reference not set to an instance of an object.)
 ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Azure.DataApiBuilder.Config.ObjectModel.RuntimeConfig..ctor(String Schema, DataSource DataSource, RuntimeEntities Entities, RuntimeOptions Runtime, DataSourceFiles DataSourceFiles) in /_/src/Config/ObjectModel/RuntimeConfig.cs:line 195
   at .ctor(Object[])
   at System.Text.Json.Serialization.Converters.LargeObjectWithParameterizedConstructorConverter`1.CreateObject(ReadStackFrame& frame)
   at System.Text.Json.Serialization.Converters.ObjectWithParameterizedConstructorConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 utf8Json, JsonTypeInfo`1 jsonTypeInfo, Nullable`1 actualByteCount)
   at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 json, JsonTypeInfo`1 jsonTypeInfo)
   at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options)
   at Azure.DataApiBuilder.Config.RuntimeConfigLoader.TryParseConfig(String json, RuntimeConfig& config, ILogger logger, String connectionString, Boolean replaceEnvVar, String dataSourceName, Dictionary`2 datasourceNameToConnectionString, EnvironmentVariableReplacementFailureMode replacementFailureMode) in /_/src/Config/RuntimeConfigLoader.cs:line 73
   at Azure.DataApiBuilder.Config.FileSystemRuntimeConfigLoader.TryLoadConfig(String path, RuntimeConfig& config, Boolean replaceEnvVar, String dataSourceName) in /_/src/Config/FileSystemRuntimeConfigLoader.cs:line 108
   at Azure.DataApiBuilder.Config.FileSystemRuntimeConfigLoader.TryLoadKnownConfig(RuntimeConfig& config, Boolean replaceEnvVar, String dataSourceName) in /_/src/Config/FileSystemRuntimeConfigLoader.cs:line 145
   at Azure.DataApiBuilder.Core.Configurations.RuntimeConfigProvider.TryGetConfig(RuntimeConfig& runtimeConfig) in /_/src/Core/Configurations/RuntimeConfigProvider.cs:line 125
   at Azure.DataApiBuilder.Core.Configurations.RuntimeConfigValidator.TryValidateConfig(String configFilePath, ILoggerFactory loggerFactory) in /_/src/Core/Configurations/RuntimeConfigValidator.cs:line 155
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at Cli.ConfigGenerator.IsConfigValid(ValidateOptions options, FileSystemRuntimeConfigLoader loader, IFileSystem fileSystem) in /_/src/Cli/ConfigGenerator.cs:line 1199
   at Cli.Commands.ValidateOptions.Handler(ILogger logger, FileSystemRuntimeConfigLoader loader, IFileSystem fileSystem) in /_/src/Cli/Commands/ValidateOptions.cs:line 31
   at Cli.Program.<>c__DisplayClass2_0.<Execute>b__5(ValidateOptions options) in /_/src/Cli/Program.cs:line 67
   at CommandLine.ParserResultExtensions.MapResult[T1,T2,T3,T4,T5,T6,T7,T8,TResult](ParserResult`1 result, Func`2 parsedFunc1, Func`2 parsedFunc2, Func`2 parsedFunc3, Func`2 parsedFunc4, Func`2 parsedFunc5, Func`2 parsedFunc6, Func`2 parsedFunc7, Func`2 parsedFunc8, Func`2 notParsedFunc)
   at Cli.Program.Execute(String[] args, ILogger cliLogger, IFileSystem fileSystem, FileSystemRuntimeConfigLoader loader) in /_/src/Cli/Program.cs:line 61
   at Cli.Program.Main(String[] args) in /_/src/Cli/Program.cs:line 41

Version

1.2.14+c7ca8db8558a63919c530e454c8f18b45d5b931c

What database are you using?

Azure SQL

What hosting model are you using?

Local (including CLI)

Which API approach are you accessing DAB through?

GraphQL, REST

Relevant log output


Code of Conduct

  • I agree to follow this project's Code of Conduct
@crushonme crushonme added bug Something isn't working triage issues to be triaged labels Nov 27, 2024
@abhishekkumams abhishekkumams added this to the 1.4 milestone Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage issues to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants