Working on an old project with SS 5.4.
There was a request to move the SS auth tables (user_auth, user_auth_details) to a separate schema.
For whatever reason SS throws the following.
System.Exception: OrmLiteAuthRepository Db tables have not been initialized. Try calling 'InitSchema()' in your AppHost Configure method.
This is on PostgreSQL.
The Auth DB user has been granted access to the schema and tables.
The db user has also included the new auth schema in the search_path
however it still seems to throw that error.
The db user via database IDE has no problem accessing the tables. With and without the schema specified.
Tried to override classes with [Schema]
attribute with no luck.
In AppHost
container.Register<IAuthRepository>(c =>
new OrmLiteAuthRepository<MyNewUserAuth, MyNewUserAuthDetails>(
c.Resolve<IDbConnectionFactory>(), NamedConnectionAuth));
New User Auth Classes
[Schema("my_new_auth_schema")]
public class MyNewUserAuth : UserAuth
{
}
[Schema("my_new_auth_schema")]
public class MyNewUserAuthDetails : UserAuthDetails
{
}
Is there a way to inspect or log the query that determines they haven’t been initialized?
Or is there a better way to handle this situation?
Thanks
Full Exception
2022-02-02 07:15:56.745 +00:00 [ERR] ServiceException: https://www.mywebsite.test/auth/credentials
System.Exception: OrmLiteAuthRepository Db tables have not been initialized. Try calling 'InitSchema()' in your AppHost Configure method.
at ServiceStack.Auth.OrmLiteAuthRepositoryBase`2.<>c__DisplayClass17_0.<GetUserAuthByUserName>b__0(IDbConnection db) in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack.Server\Auth\OrmLiteAuthRepository.cs:line 285
at ServiceStack.Auth.OrmLiteAuthRepository`2.Exec[T](Func`2 fn) in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack.Server\Auth\OrmLiteAuthRepository.cs:line 51
at ServiceStack.Auth.OrmLiteAuthRepositoryBase`2.GetUserAuthByUserName(String userNameOrEmail)
at ServiceStack.Auth.OrmLiteAuthRepositoryBase`2.TryAuthenticate(String userName, String password, IUserAuth& userAuth) in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack.Server\Auth\OrmLiteAuthRepository.cs:line 359
at ServiceStack.Auth.CredentialsAuthProvider.TryAuthenticate(IServiceBase authService, String userName, String password) in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack\Auth\CredentialsAuthProvider.cs:line 62
at ServiceStack.Auth.CredentialsAuthProvider.Authenticate(IServiceBase authService, IAuthSession session, String userName, String password, String referrerUrl) in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack\Auth\CredentialsAuthProvider.cs:line 120
at ServiceStack.Auth.CredentialsAuthProvider.Authenticate(IServiceBase authService, IAuthSession session, Authenticate request) in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack\Auth\CredentialsAuthProvider.cs:line 97
at MyCredentialsAuthProvider.Authenticate(IServiceBase authService, IAuthSession session, Authenticate request) in C:\dev\myproject\src\Project1\MyCredentialsAuthProvider.cs:line 111
at ServiceStack.Auth.AuthenticateService.Authenticate(Authenticate request, String provider, IAuthSession session, IAuthProvider oAuthConfig) in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack\Auth\AuthenticateService.cs:line 411
at ServiceStack.Auth.AuthenticateService.Post(Authenticate request) in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack\Auth\AuthenticateService.cs:line 218
at lambda_method(Closure , Object , Object )
at ServiceStack.Host.ServiceRunner`1.ExecuteAsync(IRequest req, Object instance, TRequest requestDto) in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack\Host\ServiceRunner.cs:line 133