Good Afternoon, I am facing an issue when using a Customized login method in my ABP.IO based project.
I have implemented a customized login flow using the solution provided in https://github.com/abpframework/abp-samples/tree/master/SignInWithoutSpecifyingTenant. In our solution, we have enabled Chat Module and CMSKit Module.
When we attempt to login as a tenant while using the incorrect password, we receive an AggregateException error as a result of the login attempt. When we remove the Chat and CMSKit modules, we receive the normal error that you are supposed to receive when an incorrect credential is used. When the modules are enabled and we remove the custom login flow, select our tenant and try to login with incorrect password, it also gives the proper error message.
10 Answer(s)
-
0
Hi,
Could you share the steps to reproduce or a project that can reproduce the problem with me via email? shiwei.liang@volosoft.com thanks.
-
0
Hi,
Could you share the steps to reproduce or a project that can reproduce the problem with me via email? shiwei.liang@volosoft.com thanks.
Hello liangshiwei,
I created a new project at version 5.2.1. I then opened abp suite and added the chat module package.
I then implemented customized login flow as described here https://github.com/abpframework/abp-samples/tree/master/SignInWithoutSpecifyingTenant.
I then logged in using host account and created a new tenant. I then enabled the chat feature within the tenant standard edition. I then upgraded abp packages to 5.3.4 using abp suite.
When I login with tenant using incorrect password, I am getting error when wrong password is used. Although the error in my example git repo is a little different than my original error, root cause seems to be the same. It appears for some reason an attempt is made to insert a duplicate chat user.
Please see repo @ https://github.com/jarrad78shoplogic/Testest.git
The above replicates what we did in our own project. We were running 5.2.1 and using a customized login flow for signin without specifying tenant. When we upgraded to 5.3.4 the error began for us in same manner as in the sample above.
-
0
Hi,
I will check it out.
-
0
Hi,
It's a problem, https://github.com/abpframework/abp/issues/14021. we will fix it. BTW, your ticket refuned.
For now, you can try:
[Dependency(TryRegister = true)] [ExposeServices(typeof(ILocalEventBus), typeof(LocalEventBus))] public class MyLocalEventBus : LocalEventBus, ISingletonDependency { public MyLocalEventBus( IOptions<AbpLocalEventBusOptions> options, IServiceScopeFactory serviceScopeFactory, ICurrentTenant currentTenant, IUnitOfWorkManager unitOfWorkManager, IEventHandlerInvoker eventHandlerInvoker) : base(options, serviceScopeFactory, currentTenant, unitOfWorkManager, eventHandlerInvoker) { } protected override Guid? GetEventDataTenantId(object eventData) { var tenantId = base.GetEventDataTenantId(eventData); if (tenantId.HasValue) { return tenantId; } if (eventData is EntityUpdatedEto<UserEto> data) { return data.Entity.TenantId; } return null; } } context.Services.AddSingleton<ILocalEventBus, MyLocalEventBus>();
-
0
Hello liangshiwei,
When I attempt to run automated tests within my project after applying patch I receive the following issue when attempting to execute automated tests. This seems to also be related to the original issue as AggregateException on EntityUpdatedEto is being thrown in the test project. Do I also need to apply a patch to the TestBase? If so, where should patch be applied?
All tests within the project fail.
` MyProject.Timeclock.TimeclockTests.FiveMinuteRoundingTimeShouldCalculateAsExpectedAsync(value1: 2021-01-01T01:09:00.0000000, expected: 2021-01-01T01:10:00.0000000) Source: TimeclockTests.cs line 248 Duration: 1 ms
Message: Volo.Abp.AbpInitializationException : An error occurred during the initialize Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor phase of the module MyProject.MyProjectTestBaseModule, MyProject.TestBase, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: More than one error has occurred while triggering the event: Volo.Abp.Domain.Entities.Events.Distributed.EntityUpdatedEto
1[Volo.Abp.Users.UserEto] (SqliteConnection does not support nested transactions.) (SqliteConnection does not support nested transactions.). See the inner exception for details. ---- System.AggregateException : More than one error has occurred while triggering the event: Volo.Abp.Domain.Entities.Events.Distributed.EntityUpdatedEto
1[Volo.Abp.Users.UserEto] (SqliteConnection does not support nested transactions.) (SqliteConnection does not support nested transactions.) -------- System.InvalidOperationException : SqliteConnection does not support nested transactions. -------- System.InvalidOperationException : SqliteConnection does not support nested transactions.Stack Trace: ModuleManager.InitializeModules(ApplicationInitializationContext context) AbpApplicationBase.InitializeModules() AbpIntegratedTest
1.ctor() TimeclockTests.ctor() line 21 RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions) ----- Inner Stack Trace ----- EventBusBase.ThrowOriginalExceptions(Type eventType, List
1 exceptions) EventBusBase.TriggerHandlersAsync(Type eventType, Object eventData) LocalEventBus.PublishAsync(LocalEventMessage localEventMessage) LocalEventBus.PublishToEventBusAsync(Type eventType, Object eventData) <47 more frames...> DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken) DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken) AbpDbContext1.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken) UnitOfWork.SaveChangesAsync(CancellationToken cancellationToken) UnitOfWork.CompleteAsync(CancellationToken cancellationToken) UserLookupService
2.WithNewUowAsync(Func1 func) UserLookupService
2.FindByIdAsync(Guid id, CancellationToken cancellationToken) CmsUserSynchronizer.HandleEventAsync(EntityUpdatedEto1 eventData) EventHandlerInvoker.InvokeAsync(IEventHandler eventHandler, Object eventData, Type eventType) EventBusBase.TriggerHandlerAsync(IEventHandlerFactory asyncHandlerFactory, Type eventType, Object eventData, List
1 exceptions, InboxConfig inboxConfig)` -
0
SqliteConnection does not support nested transactions
Try disabled transaction for unit tests:
Configure<AbpUnitOfWorkDefaultOptions>(options => { options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled; });
-
0
Hello,
We tried applying the fix options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled; in WebTestModule.cs of Web.Tests project but still getting following error
Message: Shouldly.ShouldAssertException : response.StatusCode should be HttpStatusCode.OK but was HttpStatusCode.Redirect
Stack Trace: ShopLogicWebTestBase.GetResponseAsync(String url, HttpStatusCode expectedStatusCode) line 35 ExceptionDispatchInfo.Throw() TaskAwaiter.ThrowForNonSuccess(Task task) TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) TaskAwaiter
1.GetResult() ShopLogicWebTestBase.GetResponseAsStringAsync(String url, HttpStatusCode expectedStatusCode) line 28 ExceptionDispatchInfo.Throw() TaskAwaiter.ThrowForNonSuccess(Task task) TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) TaskAwaiter
1.GetResult() Index_Tests.Welcome_Page() line 12 ExceptionDispatchInfo.Throw() TaskAwaiter.ThrowForNonSuccess(Task task) TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) --- End of stack trace from previous location --- ExceptionDispatchInfo.Throw() TaskAwaiter.ThrowForNonSuccess(Task task) TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) ExceptionDispatchInfo.Throw() TaskAwaiter.ThrowForNonSuccess(Task task) TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) -
0
Hi,
Sorry, But I think this is a new problem right?
Your main problem with the ticket has been solved. could you create a new question?
BTW, I guess you added the Authorize attribute to the index page, so it redirects to the login page. however, it is a unit test code, you can just ignore it.
-
0
They seem to be related since both are having exception when HandleEventAsync(EntityUpdatedEto) is called. I will go ahead and open another ticket but they do seem to be happening in exactly the same spot just in different project.
-
0
Thanks. I'm closing this.