Yes the database do not exists and when we run any microservice solution it should create the database automatically.
Doesn't this line of code expected to do that :
public override async Task OnPreApplicationInitializationAsync(ApplicationInitializationContext context)
{
using var scope = context.ServiceProvider.CreateScope();
await MigrateDatabase(scope.ServiceProvider);
}
However we used the Abp Studio to run the Migration as we get the below error
0:20:44.265 Information Starting task execution: "Updating the database: IntegrationServices.AdministrationService"20:22:24.503 Information CLI command executed. Command: "dotnet ef database update"
Working directory: "C:\SourceCode\integration-microservices\services\administration\IntegrationServices.AdministrationService"
CommandResult { ExitCode: 1, IsSuccess: False, StartTime: 09/17/2024 20:20:44 -07:00, ExitTime: 09/17/2024 20:22:24 -07:00, RunTime: 00:01:40.2136695 }
20:22:24.505 Information Failed task execution: "Updating the database: IntegrationServices.AdministrationService"
20:22:24.505 Information ERROR: "An error has occured!"
20:22:24.505 Information ERROR DETAILS: "Failed to update database in project IntegrationServices.AdministrationService"
20:22:24.505 Warning Exception of type 'Volo.Abp.Studio.AbpStudioException' was thrown.
20:22:24.507 Warning Code:AbpStudio:EfCoreUpdateDatabaseFailed
20:22:24.507 Warning Details:
20:22:24.507 Warning ---------- Exception Data ----------
ProjectName = IntegrationServices.AdministrationService
<br> Then i went ahead and tried toe apply migration like the below
dotnet ef database update --project IntegrationServices.AdministrationService --context AdministrationServiceDbContext
No migrations were applied. The database is already up to date.
When I went to the database this is what I see , only the migration history table gets created when the code is getting built :
I am very confused how things should work, you mentioned run the migrator, where is the migrator project , it doesn't come by default.
We never had such issues while using MySQL, why the process will be any different and if its different what's the correct process. I am doubting it may be to do with the code template or somehwere in the code, have you tried the project i sent you
I need to understand how oAuth works. I am trying to integrate with Okta, so I provided the Client ID and Client Secret and Authority as well and the Scope to be OpenId.
Then I went ahead and added an user into the host which I know exists in my Okta , however when I was adding the user it was asking for a password, so I gave some random password.
Then I went ahead and tried to login with the user and the password which is set in Okta and i was expecting to get through but couldn't.
Can you please explain what to expect out OAuth ?
My Bad, I was able to find by clicking on Manage Host Settings. I will close this ticket once I test it. Thank you for a quick response.
We added this :
using Volo.Abp.Account.Public.Web.Impersonation;
using Volo.Saas.Host;
typeof(AbpAccountPublicWebImpersonationModule),
typeof(SaasHostApplicationContractsModule)
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.Configure<AbpAccountOptions>(options =>
{
//For impersonation in Saas module
options.TenantAdminUserName = "admin";
options.ImpersonationTenantPermission = SaasHostPermissions.Tenants.Impersonation;
//For impersonation in Identity module
options.ImpersonationUserPermission = IdentityPermissions.Users.Impersonation;
});
}
Rest all were there . We had to add the dependencies
I will consult the team and post the code here. Waiting for your response from the Angular team.
Also is there an explanation why the code is not there to begin with.
Yes it works when we leave the page..and yes it's an angular code. However the question here is what's the expected behaviour in terms of when there are multiple uses in the tenant should there be a grid to select from like AspnetZero or do someone has to enter the user name.
And what can we do to prevent this pop up.
Thank you in advance for all your help.
Thank You @ahmedtfarukulu. This is the kind of explanation I was looking for and upon reading we cleared the Redis and it solved the problem. I never knew there was any dependency on Redis Cache for Data Seeding as its just a cache so never thought Redis would introduce issues like this. However we were able to solve it and we are now able to access everything.
BUT then we ran across another issue related to Impersonating to a Tenant using Login With this Tenant. We literally scratched our heads as all permissions were set up correctly as well as the Grants. It consistently complained that permission was missing . We then came across this document and tried to implement what's been referred here : https://abp.io/docs/commercial/8.1/modules/account/impersonation
Then we were able to make it work. But the documentation says its enabled by default above 5.0 which is not correct as we had to change the code.
Now we are running into another issue and below is the screenshot which is self explanatory :
Can you please help us identifying or letting us know what needs to be changed. Why its appearing to be a text box, it should rather show a list of users as this tenant has 2 users
@maiiming whats the next steps ? This issue has been opened since 8 days and constant back and forth has been happening but we are unable to come to any conclusive reason. I have already shared the code in the past and bunch of logs. Please escalate this issue to the next level as we are looking for a solution as soon as possible.
One thing we are noticing is this :
fail: Volo.Abp.PermissionManagement.AbpPermissionManagementDomainModule[0]
Unknown database 'PSLWeb_dev3_Administration'
MySqlConnector.MySqlException (0x80004005): Unknown database 'PSLWeb_dev3_Administration'
at MySqlConnector.Core.ServerSession.ReceiveReplyAsync(IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/ServerSession.cs:line 894
at MySqlConnector.Core.ServerSession.ConnectAsync(ConnectionSettings cs, MySqlConnection connection, Int64 startingTimestamp, ILoadBalancer loadBalancer, Activity activity, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/ServerSession.cs:line 532
at MySqlConnector.Core.ConnectionPool.ConnectSessionAsync(MySqlConnection connection, Action`4 logMessage, Int64 startingTimestamp, Activity activity, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/ConnectionPool.cs:line 428
at MySqlConnector.Core.ConnectionPool.ConnectSessionAsync(MySqlConnection connection, Action`4 logMessage, Int64 startingTimestamp, Activity activity, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/ConnectionPool.cs:line 433
at MySqlConnector.Core.ConnectionPool.GetSessionAsync(MySqlConnection connection, Int64 startingTimestamp, Int32 timeoutMilliseconds, Activity activity, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/ConnectionPool.cs:line 111
at MySqlConnector.Core.ConnectionPool.GetSessionAsync(MySqlConnection connection, Int64 startingTimestamp, Int32 timeoutMilliseconds, Activity activity, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/ConnectionPool.cs:line 144
at MySqlConnector.MySqlConnection.CreateSessionAsync(ConnectionPool pool, Int64 startingTimestamp, Activity activity, Nullable`1 ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlConnection.cs:line 919
at MySqlConnector.MySqlConnection.OpenAsync(Nullable`1 ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlConnection.cs:line 419
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternalAsync(Boolean errorsExpected, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternalAsync(Boolean errorsExpected, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenAsync(CancellationToken cancellationToken, Boolean errorsExpected)
at Pomelo.EntityFrameworkCore.MySql.Storage.Internal.MySqlRelationalConnection.OpenAsync(CancellationToken cancellationToken, Boolean errorsExpected)
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable`1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken)
at Pomelo.EntityFrameworkCore.MySql.Storage.Internal.MySqlExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable`1.AsyncEnumerator.MoveNextAsync()
at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken)
at Volo.Abp.Domain.Repositories.EntityFrameworkCore.EfCoreRepository`2.GetListAsync(Boolean includeDetails, CancellationToken cancellationToken)
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
at Volo.Abp.PermissionManagement.DynamicPermissionDefinitionStore.UpdateInMemoryStoreCache()
at Volo.Abp.PermissionManagement.DynamicPermissionDefinitionStore.EnsureCacheIsUptoDateAsync()
at Volo.Abp.PermissionManagement.DynamicPermissionDefinitionStore.GetGroupsAsync()
at Volo.Abp.PermissionManagement.AbpPermissionManagementDomainModule.PreCacheDynamicPermissionsAsync(PermissionManagementOptions options, IServiceScope scope)
fail: Volo.Abp.PermissionManagement.AbpPermissionManagementDomainModule[0]
---------- Exception Data ----------
Server Error Code = 1049
SqlState = 42000
There are more and you will get to see see in the logs, but the modules seeding is getting fired before the microservice migrations are being ran and that's causing the issue.