There is no such an entity. Entity type: <tenant>.<companyurl>Authorization.Roles.Role
On our Test site (Tenant testing) - the user seems to be getting this error almost everytime they connect after a day or so... I have tried reproducing the error but am unable to reproduce. Also not so sure if the may be related to user session or memory caching. Any assistance\ pointer will be appriciated.
See attached logs
2455 [ERROR] Abp.AspNetCore.Mvc.ExceptionHandling.AbpExceptionFilter
> There is no such an entity. Entity type: <tenant>.<companyurl>.Authorization.Roles.Role, id: 5
Abp.Domain.Entities.EntityNotFoundException: There is no such an entity. Entity type: <tenant>.<companyurl>.Authorization.Roles.Role, id: 5
at Abp.Domain.Repositories.AbpRepositoryBase`2.<GetAsync>d__21.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithPostActionAndFinallyAndGetResult>d__5`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.Authorization.Roles.AbpRoleManager`2.<>c__DisplayClass46_0.<<GetRolePermissionCacheItemAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.Runtime.Caching.CacheExtensions.<>c__DisplayClass5_0`2.<<GetAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.Runtime.Caching.CacheBase.<GetAsync>d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.Runtime.Caching.CacheExtensions.<GetAsync>d__5`2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.Authorization.Roles.AbpRoleManager`2.<GetRolePermissionCacheItemAsync>d__46.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.Authorization.Roles.AbpRoleManager`2.<IsGrantedAsync>d__27.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.Authorization.Users.AbpUserManager`2.<IsGrantedAsync>d__36.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.Authorization.Users.AbpUserManager`2.<IsGrantedAsync>d__34.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.Authorization.PermissionChecker`2.<IsGrantedAsync>d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.Authorization.PermissionChecker`2.<IsGrantedAsync>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.Web.Configuration.AbpUserConfigurationBuilder.<GetUserAuthConfig>d__43.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.Web.Configuration.AbpUserConfigurationBuilder.<GetAll>d__38.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.AspNetCore.Mvc.Controllers.AbpUserConfigurationController.<GetAll>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at lambda_method(Closure , Object )
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionMethodAsync>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextActionFilterAsync>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeInnerFilterAsync>d__14.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeNextExceptionFilterAsync>d__23.MoveNext()
20 Answer(s)
-
0
Does role with Id = 5 exist in the table?
-
0
Yes it does. Infact as soon as I clear the Cache from the Host Site... everything seems to be all good after until the next time.
-
0
hi,
To clearify things, I have 2 questions
1- Is there any other Host (behind load balancer etc...). I am asking because if any other instance of the backbone inserts into the database, the other instance might have problem. 2- Is there any custom code that you insert into the AbpRoles table?
-
0
Sure. 1- This is just our test envrionment - so only one database host. 2 - No - there is no custom code around roles and or permissions tables.
-
0
which AspNetZero version you are using ?
could you log the value of AbpSession.TenantId to see if it is the correct tenant (or host) that you want ?
-
0
AspNetZero - 5.4 AbpSession.TenantId was as expected and correct.
I have a theory - may be one you could correct me if not correct.
"If the application has not been accessed for 24 hours we would see this error appear and based on the log i think the cache still exist but the Cached objects (entity) are no longer present or corrupt. (I have only just been able to see the error my self for the first time today. hence the theory)"
Hopefully my theory makes sense
-
0
Do you see similar error outside of
AbpUserConfigurationController.GetAll()
? -
0
I can't be sure cause it has been hard to reproduce in dev but NO.
-
0
Hi, can you check if both
AbpSession.TenantId
andTenantId
ofCurrentUnitOfWork
are the same?TenantId of CurrentUnitOfWork can be obtained by the following:
if (_unitOfWorkManager.Current != null) { var tenantId = _unitOfWorkManager.Current.GetTenantId(); }
-
0
Could you also share your AspNet Zero version ?
-
0
@ismcagdas
- AspNet Zero Version - v5.4.1
@ryancyq
- it has been hard to reproduce but i am very sure the tenant id were the same...
-
0
Are you still struggling with this issue?
-
0
@alper Yes we are still seeing this pop up all the time - haven't got a fix yet.
-
0
Are you using PostgreSQL ?
-
0
@ismcagdas SQL Server Web Edition 14.00.3015.40.v1
-
0
Sorry for my late response. Your problem might be similar to https://github.com/aspnetboilerplate/aspnetboilerplate/issues/3369#issuecomment-433733606
-
0
@ismcagdas - that seems to be purely related to PostgreSQL - I have said above we are using SQL Server Web Edition 14.00.3015.40.v1?
-
0
Hi, [email protected], can you try with
[UnitOfWork(IsTransactional=false)]
onTokenAuthController.Authenticate()
? to check if the error still occurs? -
0
Hello, I have exactly the same error, is there any solution for this problem? i am using AspNet Zero v5.6.2 I use Sql Server 2017. I also think that there is a problem when the site is not reached or somehow when the user keep the same browser session for a long time. But i am super sure that this is not related with database. Cause after i get this error from the client i tried to do impersonation and i get exactly the same error. And When you restart iis the problem is going away.
and here is the stack trace for the error if you are curious.
ERROR 2018-12-17 10:34:56,118 [136 ] Mvc.ExceptionHandling.AbpExceptionFilter - There is no such an entity. Entity type: ByteBrick.BookAndAd.Authorization.Roles.Role, id: 1 Abp.Domain.Entities.EntityNotFoundException: There is no such an entity. Entity type: ByteBrick.BookAndAd.Authorization.Roles.Role, id: 1 at Abp.Domain.Repositories.AbpRepositoryBase
2.<GetAsync>d__21.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithPostActionAndFinallyAndGetResult>d__5
1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Authorization.Roles.AbpRoleManager2.<>c__DisplayClass50_0.<<GetRolePermissionCacheItemAsync>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Runtime.Caching.CacheExtensions.<>c__DisplayClass5_0
2.<<GetAsync>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Runtime.Caching.CacheBase.<GetAsync>d__19.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Runtime.Caching.CacheExtensions.<GetAsync>d__52.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Authorization.Roles.AbpRoleManager
2.<GetRolePermissionCacheItemAsync>d__50.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Authorization.Roles.AbpRoleManager2.<IsGrantedAsync>d__31.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Authorization.Users.AbpUserManager
2.<IsGrantedAsync>d__40.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Authorization.Users.AbpUserManager2.<IsGrantedAsync>d__38.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Authorization.PermissionChecker
2.<IsGrantedAsync>d__19.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Authorization.PermissionChecker`2. -
0
Please reopen if this issue is not fixed.