PSU Node keeps enabling OIDC when connecting to SQL

Product: PowerShell Universal
Version: 3.10.1

I am standing up a new PSU node (We’ll call it PSU3) and am having a weird issues.

When inititally standing up the node, I have it connect to LiteDB, then setup Git and have it sync. No issues during this whole process.

Once I configure appsettings.json to connect to my SQL table, it suddenly enables OIDC and starts throwing a 500 error. Problem is, I have no idea where OIDC is getting enabled from. Its not set in either of the two appsettings.json files, nor authentication.ps1.

Removing the SQL connection string and going back to LiteDB instantly resolves the issue, and I am able to connect to the node again.

The error in the logs is the following:

2023-11-15 10:51:02.928 -05:00 [INF] Request starting HTTP/1.1 GET http://------:5000/login - -
2023-11-15 10:51:02.929 -05:00 [ERR] Connection id "0HMV5UAKG19LB", Request id "0HMV5UAKG19LB:00000003": An unhandled exception was thrown by the application.
System.ArgumentException: Options.ClientId must be provided (Parameter 'ClientId')
   at Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectOptions.Validate()
   at Microsoft.AspNetCore.Authentication.RemoteAuthenticationOptions.Validate(String scheme)
   at Microsoft.AspNetCore.Authentication.AuthenticationBuilder.<>c__DisplayClass4_0`2.<AddSchemeHelper>b__1(TOptions o)
   at Microsoft.Extensions.Options.ValidateOptions`1.Validate(String name, TOptions options)
   at Microsoft.Extensions.Options.OptionsFactory`1.Create(String name)
   at Microsoft.Extensions.Options.OptionsMonitor`1.<>c__DisplayClass10_0.<Get>b__0()
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
--- End of stack trace from previous location ---
   at System.Lazy`1.CreateValue()
   at Microsoft.Extensions.Options.OptionsCache`1.GetOrAdd(String name, Func`1 createOptions)
   at Microsoft.Extensions.Options.OptionsMonitor`1.Get(String name)
   at Microsoft.AspNetCore.Authentication.AuthenticationHandler`1.InitializeAsync(AuthenticationScheme scheme, HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationHandlerProvider.GetHandlerAsync(HttpContext context, String authenticationScheme)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
2023-11-15 10:51:02.931 -05:00 [INF] Request finished HTTP/1.1 GET http://------:5000/login - - - 500 0 - 2.1314ms

However, I also see this error in the logs, which could be related and I am just going down a rabbit hole:

2023-11-15 10:50:29.897 -05:00 [ERR] Failed to sync.
System.InvalidOperationException: An attempt was made to use the context instance while it is being configured. A DbContext instance cannot be used inside 'OnConfiguring' since it is still being configured at this point. This can happen if a second operation is started on this context instance before a previous operation completed. Any instance members are not guaranteed to be thread safe.
   at Microsoft.EntityFrameworkCore.DbContext.get_ContextServices()
   at Microsoft.EntityFrameworkCore.DbContext.get_InternalServiceProvider()
   at Microsoft.EntityFrameworkCore.DbContext.get_DbContextDependencies()
   at Microsoft.EntityFrameworkCore.DbContext.Set[TEntity]()
   at PowerShellUniversal.SQL.SqlTable`1.get_Queryable() in C:\actions-runner\_work\universal\universal\src\PowerShellUniversal.SQL\Database.cs:line 590
   at PowerShellUniversal.SQL.SqlTable`1.Where(Expression`1 predicate) in C:\actions-runner\_work\universal\universal\src\PowerShellUniversal.SQL\Database.cs:line 690
   at UniversalAutomation.GitSyncService.Sync(Boolean force) in C:\actions-runner\_work\universal\universal\src\Universal.Server\Services\GitSyncService.cs:line 73
2023-11-15 10:50:29.961 -05:00 [WRN] Failed to process the job '2517500': an exception occured. Job was automatically deleted because the retry attempt count exceeded 0.
System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.Data.SqlClient.SqlConnection.get_TypeSystem()
   at Microsoft.Data.SqlClient.SqlDataReader..ctor(SqlCommand command, CommandBehavior behavior)
   at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean isAsync, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
   at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry, String method)
   at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at Microsoft.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.ExecuteReader()
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReader(RelationalCommandParameterObject parameterObject)
   at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.Enumerator.InitializeReader(Enumerator enumerator)
   at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.Enumerator.<>c.<MoveNext>b__19_0(DbContext _, Enumerator enumerator)
   at Microsoft.EntityFrameworkCore.Storage.ExecutionStrategy.<>c__DisplayClass31_0`2.<Execute>b__0(DbContext context, TState state)
   at Microsoft.EntityFrameworkCore.Storage.ExecutionStrategy.ExecuteImplementation[TState,TResult](Func`3 operation, Func`3 verifySucceeded, TState state)
   at Microsoft.EntityFrameworkCore.Storage.ExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
   at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.Enumerator.MoveNext()
   at System.Collections.Generic.LargeArrayBuilder`1.AddRange(IEnumerable`1 items)
   at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at PowerShellUniversal.SQL.SqlTable`1.<>c.<ToArray>b__18_0(IQueryable`1 m) in C:\actions-runner\_work\universal\universal\src\PowerShellUniversal.SQL\Database.cs:line 675
   at PowerShellUniversal.SQL.SqlTable`1.DisposeAfterCall[X](Func`2 call) in C:\actions-runner\_work\universal\universal\src\PowerShellUniversal.SQL\Database.cs:line 735
   at PowerShellUniversal.SQL.SqlTable`1.ToArray() in C:\actions-runner\_work\universal\universal\src\PowerShellUniversal.SQL\Database.cs:line 675
   at UniversalAutomation.Services.AppTokenService.Load() in C:\actions-runner\_work\universal\universal\src\Universal.Server\Services\Authentication\AppTokenService.cs:line 27

Any help would be greatly appreciated, I’ve been chewing at this for a few days, and keep coming to the same issue. I’ve tried re-installs, downgrades, upgrades, no dice.