Skip to content

[Bug]: Object reference not set to Instance of an object #1675

@atyshka

Description

@atyshka

What happened?

I am getting the following error when running data-api-builder via the SWA dev server:

[dataApi] fail: Azure.DataApiBuilder.Service.Startup[0]
[dataApi]       Unable to complete runtime initialization. Refer to exception for error details.
[dataApi]       System.NullReferenceException: Object reference not set to an instance of an object.
[dataApi]          at Azure.DataApiBuilder.Core.Configurations.RuntimeConfigValidator.ValidateGlobalEndpointRouteConfig(RuntimeConfig runtimeConfig) in /_/src/Core/Configurations/RuntimeConfigValidator.cs:line 336
[dataApi]          at Azure.DataApiBuilder.Core.Configurations.RuntimeConfigValidator.ValidateConfig() in /_/src/Core/Configurations/RuntimeConfigValidator.cs:line 75
[dataApi]          at Azure.DataApiBuilder.Service.Startup.PerformOnConfigChangeAsync(IApplicationBuilder app) in /_/src/Service/Startup.cs:line 565
[dataApi] fail: Azure.DataApiBuilder.Service.Startup[0]
[dataApi]       Exiting the runtime engine...
[dataApi] crit: Microsoft.AspNetCore.Hosting.Diagnostics[6]
[dataApi]       Application startup exception
[dataApi]       System.ApplicationException: Could not initialize the engine with the runtime config file: staticwebapp.database.config.json
[dataApi]          at Azure.DataApiBuilder.Service.Startup.Configure(IApplicationBuilder app, IWebHostEnvironment env, RuntimeConfigProvider runtimeConfigProvider) in /_/src/Service/Startup.cs:line 306
[dataApi]          at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
[dataApi]          at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
[dataApi]          at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
[dataApi]          at Microsoft.AspNetCore.Hosting.ConfigureBuilder.<>c__DisplayClass4_0.<Build>b__0(IApplicationBuilder builder)
[dataApi]          at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass15_0.<UseStartup>b__1(IApplicationBuilder app)
[dataApi]          at Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterBuilderStartupFilter.<>c__DisplayClass0_0.<Configure>g__MiddlewareFilterBuilder|0(IApplicationBuilder builder)
[dataApi]          at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder app)
[dataApi]          at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
[dataApi] Unable to launch the runtime due to: System.ApplicationException: Could not initialize the engine with the runtime config file: staticwebapp.database.config.json

This just broke this morning. I noticed that SWA was downloading a new version of DAB and I wonder if that was what caused the issue?

My config file hasn't changed recently, here it is:

{
  "$schema": "https://github.com/Azure/data-api-builder/releases/download/v0.7.6/dab.draft.schema.json",
  "data-source": {
    "database-type": "cosmosdb_nosql",
    "options": {
      "database": "teaching-study",
      "schema": "staticwebapp.database.schema.gql"
    },
    "connection-string": "@env('DATABASE_CONNECTION_STRING')"
  },
  "runtime": {
    "graphql": {
      "allow-introspection": true,
      "enabled": true,
      "path": "/graphql"
    },
    "host": {
      "mode": "production",
      "cors": {
        "origins": [],
        "allow-credentials": false
      },
      "authentication": {
        "provider": "StaticWebApps"
      }
    }
  },
  "entities": {
    "Person": {
      "source": "participant-container",
      "permissions": [
        {
          "actions": ["create", "update", "read"],
          "role": "anonymous"
        }
      ]
    },
    "Submission": {
      "source": "submission-container",
      "permissions": [
        {
          "actions": ["create"],
          "role": "anonymous"
        }
      ]
    },
    "Questionnaire": {
      "source": "questionnaire-container",
      "permissions": [
        {
          "actions": ["create"],
          "role": "anonymous"
        }
      ]
    }
  }
}

Version

0.8.49

What database are you using?

CosmosDB NoSQL

What hosting model are you using?

Static Web Apps (SWA)

Which API approach are you accessing DAB through?

GraphQL

Relevant log output

No response

Code of Conduct

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtriageissues to be triaged

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions