Skip to content

[Bug]: dab validate returns an Unhandled Exception if a table definition is not inferred  #2037

@Aniruddh25

Description

@Aniruddh25

What happened?

Provided a config where the source object for the Book entity was not present in the file.
Expected dab validate to just error out saying unable to fetch schema for Book.
Instead, it hangs as follows throwing an unhandled exception:
image

Version

0.11.6-rc

What database are you using?

Azure SQL

What hosting model are you using?

Local (including CLI)

Which API approach are you accessing DAB through?

REST

Relevant log output

Information: Microsoft.DataApiBuilder 0.11.6-rc+f557b4da4c350f878d9a44632037daef9349f769
Information: Config not provided. Trying to get default config based on DAB_ENVIRONMENT...
Information: Environment variable DAB_ENVIRONMENT is (null)
Loading config file from dab-config.json.
Information: Loaded config file: dab-config.json
Error: Failed to get schema from url: https://dataapibuilder.azureedge.net/schemas/v0.11.6-rc/dab.draft.schema.json
System.Net.Http.HttpRequestException: Response status code does not indicate success: 404 (Not Found).
   at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
   at CallSite.Target(Closure , CallSite , Object )
   at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid1[T0](CallSite site, T0 arg0)
   at NJsonSchema.Infrastructure.DynamicApis.HttpGetAsync(String url, CancellationToken cancellationToken)
   at NJsonSchema.JsonSchema.FromUrlAsync(String url, Func`2 referenceResolverFactory, CancellationToken cancellationToken)
   at Azure.DataApiBuilder.Core.Configurations.JsonConfigSchemaValidator.GetJsonSchema(RuntimeConfig runtimeConfig)
Loading config file from dab-config.json.
Information: [Book] REST path: /api/Book
Unhandled exception. System.AggregateException: One or more errors occurred. (Table Definition for Book has not been inferred.)
 ---> Azure.DataApiBuilder.Service.Exceptions.DataApiBuilderException: Table Definition for Book has not been inferred.
   at Azure.DataApiBuilder.Core.Services.SqlMetadataProvider`3.GetSourceDefinition(String entityName)
   at Azure.DataApiBuilder.Core.Services.SqlMetadataProvider`3.LogPrimaryKeys()
   at Azure.DataApiBuilder.Core.Services.SqlMetadataProvider`3.InitializeAsync()
   at Azure.DataApiBuilder.Core.Services.MetadataProviders.MetadataProviderFactory.InitializeAsync()
   at Azure.DataApiBuilder.Core.Configurations.RuntimeConfigValidator.ValidateEntitiesMetadata(RuntimeConfig runtimeConfig, ILoggerFactory loggerFactory)      
   at Azure.DataApiBuilder.Core.Configurations.RuntimeConfigValidator.TryValidateConfig(String configFilePath, RuntimeConfig runtimeConfig, ILoggerFactory loggerFactory, Boolean isValidateOnly)
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at Cli.ConfigGenerator.IsConfigValid(ValidateOptions options, FileSystemRuntimeConfigLoader loader, IFileSystem fileSystem)
   at Cli.Commands.ValidateOptions.Handler(ILogger logger, FileSystemRuntimeConfigLoader loader, IFileSystem fileSystem)
   at Cli.Program.<>c__DisplayClass2_0.<Execute>b__5(ValidateOptions options)
   at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult`1 result, Action`1 action)
   at Cli.Program.Execute(String[] args, ILogger cliLogger, IFileSystem fileSystem, FileSystemRuntimeConfigLoader loader)
   at Cli.Program.Main(String[] args)

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions