Open Closed

Getting 500 internal server error on Impersonate Login #11255


0
Aitor created

I'm using ASPNET CORE & Angular v 11.3.1

I'm having an issue impersonating in my server I have my solution runing on AWS angular is located on a S3 bucket static website and my Net Core solution is on an ElastickBeanstalk EC2 I also use a DNS with cloudflare to reach the server

The issue is that I can impersonate properly running the solution locally everything works fine but as soon as I use this on the server I always get 500 internal server error:

The trace of the error is this

Sep 14 21:03:07 ip-172-30-1-6 web: ERROR 2022-09-14 21:03:07,465 [31 ] Mvc.ExceptionHandling.AbpExceptionFilter - Current tenant is different than given tenant. AbpSession.TenantId: , given tenantId: 2 Sep 14 21:03:07 ip-172-30-1-6 web: System.Exception: Current tenant is different than given tenant. AbpSession.TenantId: , given tenantId: 2 Sep 14 21:03:07 ip-172-30-1-6 web: at PARPlatform.Authorization.Impersonation.ImpersonationManager.CheckCurrentTenant(Nullable1 tenantId) in C:\Users\pedro\OneDrive\Documentos\plataformapar\aspnet-core\src\PARPlatform.Core\Authorization\Impersonation\ImpersonationManager.cs:line 113 Sep 14 21:03:07 ip-172-30-1-6 web: at PARPlatform.Authorization.Impersonation.ImpersonationManager.GetImpersonatedUserAndIdentity(String impersonationToken) in C:\Users\pedro\OneDrive\Documentos\plataformapar\aspnet-core\src\PARPlatform.Core\Authorization\Impersonation\ImpersonationManager.cs:line 42 Sep 14 21:03:07 ip-172-30-1-6 web: at PARPlatform.Web.Controllers.TokenAuthController.ImpersonatedAuthenticate(String impersonationToken) in C:\Users\pedro\OneDrive\Documentos\plataformapar\aspnet-core\src\PARPlatform.Web.Core\Controllers\TokenAuthController.cs:line 379 Sep 14 21:03:07 ip-172-30-1-6 web: at lambda_method2674(Closure , Object ) Sep 14 21:03:07 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) Sep 14 21:03:07 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask1 actionResultValueTask) Sep 14 21:03:07 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) Sep 14 21:03:07 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) Sep 14 21:03:07 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) Sep 14 21:03:07 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) Sep 14 21:03:07 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) Sep 14 21:03:09 ip-172-30-1-6 web: ERROR 2022-09-14 21:03:09,284 [31 ] Mvc.ExceptionHandling.AbpExceptionFilter - Current tenant is different than given tenant. AbpSession.TenantId: , given tenantId: 2 Sep 14 21:03:09 ip-172-30-1-6 web: System.Exception: Current tenant is different than given tenant. AbpSession.TenantId: , given tenantId: 2 Sep 14 21:03:09 ip-172-30-1-6 web: at PARPlatform.Authorization.Impersonation.ImpersonationManager.CheckCurrentTenant(Nullable1 tenantId) in C:\Users\pedro\OneDrive\Documentos\plataformapar\aspnet-core\src\PARPlatform.Core\Authorization\Impersonation\ImpersonationManager.cs:line 113 Sep 14 21:03:09 ip-172-30-1-6 web: at PARPlatform.Authorization.Impersonation.ImpersonationManager.GetImpersonatedUserAndIdentity(String impersonationToken) in C:\Users\pedro\OneDrive\Documentos\plataformapar\aspnet-core\src\PARPlatform.Core\Authorization\Impersonation\ImpersonationManager.cs:line 42 Sep 14 21:03:09 ip-172-30-1-6 web: at PARPlatform.Web.Controllers.TokenAuthController.ImpersonatedAuthenticate(String impersonationToken) in C:\Users\pedro\OneDrive\Documentos\plataformapar\aspnet-core\src\PARPlatform.Web.Core\Controllers\TokenAuthController.cs:line 379 Sep 14 21:03:09 ip-172-30-1-6 web: at lambda_method2674(Closure , Object ) Sep 14 21:03:09 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) Sep 14 21:03:09 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask1 actionResultValueTask) Sep 14 21:03:09 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) Sep 14 21:03:09 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) Sep 14 21:03:09 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) Sep 14 21:03:09 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) Sep 14 21:03:09 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) Sep 14 21:03:11 ip-172-30-1-6 web: ERROR 2022-09-14 21:03:11,232 [31 ] Mvc.ExceptionHandling.AbpExceptionFilter - Current tenant is different than given tenant. AbpSession.TenantId: , given tenantId: 2 Sep 14 21:03:11 ip-172-30-1-6 web: System.Exception: Current tenant is different than given tenant. AbpSession.TenantId: , given tenantId: 2 Sep 14 21:03:11 ip-172-30-1-6 web: at PARPlatform.Authorization.Impersonation.ImpersonationManager.CheckCurrentTenant(Nullable1 tenantId) in C:\Users\pedro\OneDrive\Documentos\plataformapar\aspnet-core\src\PARPlatform.Core\Authorization\Impersonation\ImpersonationManager.cs:line 113 Sep 14 21:03:11 ip-172-30-1-6 web: at PARPlatform.Authorization.Impersonation.ImpersonationManager.GetImpersonatedUserAndIdentity(String impersonationToken) in C:\Users\pedro\OneDrive\Documentos\plataformapar\aspnet-core\src\PARPlatform.Core\Authorization\Impersonation\ImpersonationManager.cs:line 42 Sep 14 21:03:11 ip-172-30-1-6 web: at PARPlatform.Web.Controllers.TokenAuthController.ImpersonatedAuthenticate(String impersonationToken) in C:\Users\pedro\OneDrive\Documentos\plataformapar\aspnet-core\src\PARPlatform.Web.Core\Controllers\TokenAuthController.cs:line 379 Sep 14 21:03:11 ip-172-30-1-6 web: at lambda_method2674(Closure , Object ) Sep 14 21:03:11 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) Sep 14 21:03:11 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask1 actionResultValueTask) Sep 14 21:03:11 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) Sep 14 21:03:11 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) Sep 14 21:03:11 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) Sep 14 21:03:11 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) Sep 14 21:03:11 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) Sep 14 21:03:13 ip-172-30-1-6 web: ERROR 2022-09-14 21:03:13,333 [26 ] Mvc.ExceptionHandling.AbpExceptionFilter - Current tenant is different than given tenant. AbpSession.TenantId: , given tenantId: 2 Sep 14 21:03:13 ip-172-30-1-6 web: System.Exception: Current tenant is different than given tenant. AbpSession.TenantId: , given tenantId: 2 Sep 14 21:03:13 ip-172-30-1-6 web: at PARPlatform.Authorization.Impersonation.ImpersonationManager.CheckCurrentTenant(Nullable1 tenantId) in C:\Users\pedro\OneDrive\Documentos\plataformapar\aspnet-core\src\PARPlatform.Core\Authorization\Impersonation\ImpersonationManager.cs:line 113 Sep 14 21:03:13 ip-172-30-1-6 web: at PARPlatform.Authorization.Impersonation.ImpersonationManager.GetImpersonatedUserAndIdentity(String impersonationToken) in C:\Users\pedro\OneDrive\Documentos\plataformapar\aspnet-core\src\PARPlatform.Core\Authorization\Impersonation\ImpersonationManager.cs:line 42 Sep 14 21:03:13 ip-172-30-1-6 web: at PARPlatform.Web.Controllers.TokenAuthController.ImpersonatedAuthenticate(String impersonationToken) in C:\Users\pedro\OneDrive\Documentos\plataformapar\aspnet-core\src\PARPlatform.Web.Core\Controllers\TokenAuthController.cs:line 379 Sep 14 21:03:13 ip-172-30-1-6 web: at lambda_method2674(Closure , Object ) Sep 14 21:03:13 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) Sep 14 21:03:13 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask1 actionResultValueTask) Sep 14 21:03:13 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) Sep 14 21:03:13 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) Sep 14 21:03:13 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) Sep 14 21:03:13 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) Sep 14 21:03:13 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) Sep 14 21:03:20 ip-172-30-1-6 web: ERROR 2022-09-14 21:03:20,164 [32 ] Mvc.ExceptionHandling.AbpExceptionFilter - Current tenant is different than given tenant. AbpSession.TenantId: , given tenantId: 2 Sep 14 21:03:20 ip-172-30-1-6 web: System.Exception: Current tenant is different than given tenant. AbpSession.TenantId: , given tenantId: 2 Sep 14 21:03:20 ip-172-30-1-6 web: at PARPlatform.Authorization.Impersonation.ImpersonationManager.CheckCurrentTenant(Nullable1 tenantId) in C:\Users\pedro\OneDrive\Documentos\plataformapar\aspnet-core\src\PARPlatform.Core\Authorization\Impersonation\ImpersonationManager.cs:line 113 Sep 14 21:03:20 ip-172-30-1-6 web: at PARPlatform.Authorization.Impersonation.ImpersonationManager.GetImpersonatedUserAndIdentity(String impersonationToken) in C:\Users\pedro\OneDrive\Documentos\plataformapar\aspnet-core\src\PARPlatform.Core\Authorization\Impersonation\ImpersonationManager.cs:line 42 Sep 14 21:03:20 ip-172-30-1-6 web: at PARPlatform.Web.Controllers.TokenAuthController.ImpersonatedAuthenticate(String impersonationToken) in C:\Users\pedro\OneDrive\Documentos\plataformapar\aspnet-core\src\PARPlatform.Web.Core\Controllers\TokenAuthController.cs:line 379 Sep 14 21:03:20 ip-172-30-1-6 web: at lambda_method2674(Closure , Object ) Sep 14 21:03:20 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) Sep 14 21:03:20 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask1 actionResultValueTask) Sep 14 21:03:20 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) Sep 14 21:03:20 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) Sep 14 21:03:20 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) Sep 14 21:03:20 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) Sep 14 21:03:20 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) Sep 14 21:04:22 ip-172-30-1-6 web: WARN 2022-09-14 21:04:22,701 [27 ] Mvc.ExceptionHandling.AbpExceptionFilter - Sep 14 21:04:22 ip-172-30-1-6 web: Token de personificación es inválido o ha expirado! Sep 14 21:04:22 ip-172-30-1-6 web: Abp.UI.UserFriendlyException: Sep 14 21:04:22 ip-172-30-1-6 web: Token de personificación es inválido o ha expirado! Sep 14 21:04:22 ip-172-30-1-6 web: at PARPlatform.Authorization.Impersonation.ImpersonationManager.GetImpersonatedUserAndIdentity(String impersonationToken) in C:\Users\pedro\OneDrive\Documentos\plataformapar\aspnet-core\src\PARPlatform.Core\Authorization\Impersonation\ImpersonationManager.cs:line 39 Sep 14 21:04:22 ip-172-30-1-6 web: at PARPlatform.Web.Controllers.TokenAuthController.ImpersonatedAuthenticate(String impersonationToken) in C:\Users\pedro\OneDrive\Documentos\plataformapar\aspnet-core\src\PARPlatform.Web.Core\Controllers\TokenAuthController.cs:line 379 Sep 14 21:04:22 ip-172-30-1-6 web: at lambda_method2674(Closure , Object ) Sep 14 21:04:22 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) Sep 14 21:04:22 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)


1 Answer(s)