Open Closed

CosmosDB - Error on navigating 'Roles' #7370


User avatar
0
pelc.stefan created
  • ABP Framework version: v3.1.8
  • UI Type: Blazor Server
  • Database System: MongoDB
  • Tiered (for MVC) or Auth Server Separated (for Angular): no
  • Exception message and full stack trace:
 2024-06-19 10:29:34.423 +02:00 [DBG] PermissionStore.GetCacheItemAsync: pn:R,pk:admin,n:AbpIdentity.Roles.Create
2024-06-19 10:29:34.423 +02:00 [DBG] Found in the cache: pn:R,pk:admin,n:AbpIdentity.Roles.Create
2024-06-19 10:29:34.593 +02:00 [ERR] An error occurred while deserializing the RoleId property of class <>f__AnonymousType0`2[[System.Guid, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Int32, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]: Cannot deserialize a 'Guid' from BsonType 'Null'.
System.FormatException: An error occurred while deserializing the RoleId property of class &lt;&gt;f__AnonymousType0`2[[System.Guid, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Int32, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]: Cannot deserialize a 'Guid' from BsonType 'Null'.
 ---> System.FormatException: Cannot deserialize a 'Guid' from BsonType 'Null'.
   at MongoDB.Bson.Serialization.Serializers.GuidSerializer.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
   at MongoDB.Bson.Serialization.Serializers.SerializerBase`1.MongoDB.Bson.Serialization.IBsonSerializer.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
   at MongoDB.Bson.Serialization.BsonClassMapSerializer`1.DeserializeMemberValue(BsonDeserializationContext context, BsonMemberMap memberMap)
   --- End of inner exception stack trace ---
   at MongoDB.Bson.Serialization.BsonClassMapSerializer`1.DeserializeMemberValue(BsonDeserializationContext context, BsonMemberMap memberMap)
   at MongoDB.Bson.Serialization.BsonClassMapSerializer`1.DeserializeClass(BsonDeserializationContext context)
   at MongoDB.Bson.Serialization.BsonClassMapSerializer`1.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
   at MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize[TValue](IBsonSerializer`1 serializer, BsonDeserializationContext context)
   at MongoDB.Bson.Serialization.Serializers.EnumerableSerializerBase`2.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
   at MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize[TValue](IBsonSerializer`1 serializer, BsonDeserializationContext context)
   at MongoDB.Driver.Core.Operations.AggregateOperation`1.CursorDeserializer.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
   at MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize[TValue](IBsonSerializer`1 serializer, BsonDeserializationContext context)
   at MongoDB.Driver.Core.Operations.AggregateOperation`1.AggregateResultDeserializer.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
   at MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize[TValue](IBsonSerializer`1 serializer, BsonDeserializationContext context)
   at MongoDB.Driver.Core.WireProtocol.CommandUsingCommandMessageWireProtocol`1.ProcessResponse(ConnectionId connectionId, CommandMessage responseMessage)
   at MongoDB.Driver.Core.WireProtocol.CommandUsingCommandMessageWireProtocol`1.ExecuteAsync(IConnection connection, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Servers.Server.ServerChannel.ExecuteProtocolAsync[TResult](IWireProtocol`1 protocol, ICoreSession session, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Operations.RetryableReadOperationExecutor.ExecuteAsync[TResult](IRetryableReadOperation`1 operation, RetryableReadContext context, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Operations.ReadCommandOperation`1.ExecuteAsync(RetryableReadContext context, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Operations.AggregateOperation`1.ExecuteAsync(RetryableReadContext context, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Operations.AggregateOperation`1.ExecuteAsync(IReadBinding binding, CancellationToken cancellationToken)
   at MongoDB.Driver.OperationExecutor.ExecuteReadOperationAsync[TResult](IReadBinding binding, IReadOperation`1 operation, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoCollectionImpl`1.ExecuteReadOperationAsync[TResult](IClientSessionHandle session, IReadOperation`1 operation, ReadPreference readPreference, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoCollectionImpl`1.AggregateAsync[TResult](IClientSessionHandle session, PipelineDefinition`2 pipeline, AggregateOptions options, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoCollectionImpl`1.UsingImplicitSessionAsync[TResult](Func`2 funcAsync, CancellationToken cancellationToken)
   at MongoDB.Driver.Linq.Linq3Implementation.Translators.ExpressionToExecutableQueryTranslators.ExecutableQuery`3.ExecuteAsync(IClientSessionHandle session, CancellationToken cancellationToken)
   at MongoDB.Driver.IAsyncCursorSourceExtensions.ToListAsync[TDocument](IAsyncCursorSource`1 source, CancellationToken cancellationToken)
   at Volo.Abp.Identity.MongoDB.MongoIdentityRoleRepository.GetListWithUserCountAsync(String sorting, Int32 maxResultCount, Int32 skipCount, String filter, 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.Identity.IdentityRoleAppService.GetListAsync(GetIdentityRoleListInput input)
   at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
   at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
   at Volo.Abp.Authorization.AuthorizationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
   at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
   at Volo.Abp.GlobalFeatures.GlobalFeatureInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
   at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
   at Volo.Abp.Auditing.AuditingInterceptor.ProceedByLoggingAsync(IAbpMethodInvocation invocation, AbpAuditingOptions options, IAuditingHelper auditingHelper, IAuditLogScope auditLogScope)
   at Volo.Abp.Auditing.AuditingInterceptor.ProcessWithNewAuditingScopeAsync(IAbpMethodInvocation invocation, AbpAuditingOptions options, ICurrentUser currentUser, IAuditingManager auditingManager, IAuditingHelper auditingHelper, IUnitOfWorkManager unitOfWorkManager)
   at Volo.Abp.Auditing.AuditingInterceptor.ProcessWithNewAuditingScopeAsync(IAbpMethodInvocation invocation, AbpAuditingOptions options, ICurrentUser currentUser, IAuditingManager auditingManager, IAuditingHelper auditingHelper, IUnitOfWorkManager unitOfWorkManager)
   at Volo.Abp.Auditing.AuditingInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
   at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
   at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   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.BlazoriseUI.AbpCrudPageBase`10.GetEntitiesAsync()
2024-06-19 10:29:34.598 +02:00 [DBG] PermissionStore.GetCacheItemAsync: pn:U,pk:8e3f9aa8-6ebd-82fb-ea62-3a1303d4c164,n:AbpIdentity.Roles.Create
2024-06-19 10:29:34.598 +02:00 [DBG] Found in the cache: pn:U,pk:8e3f9aa8-6ebd-82fb-ea62-3a1303d4c164,n:AbpIdentity.Roles.Create
  • Steps to reproduce the issue:

I cannot navigate to 'roles' , an 'iternal error' appears After searching the log i found an error relating to indexes, so i created an composition index using: db.AbpBackgroundJobs.createIndex({ Priority: -1, TryCount: 1, NextTryTime: 1}) But then this error appeared.

  • The only role in the collection is this:
[
  {
    "_id": "yJXqnzSze3em2zoTA9TE+A==",
    "ConcurrencyStamp": "de25f7b37ead43e28debf90554020aa8",
    "TenantId": null,
    "Name": "admin",
    "NormalizedName": "ADMIN",
    "Claims": [],
    "IsDefault": false,
    "IsStatic": true,
    "IsPublic": true,
    "EntityVersion": 0
  }
]

the permission grants are this:

[
  {
    "_id": "KrPerQOJ4gDU3DoTA9TLQw==",
    "TenantId": null,
    "Name": "FeatureManagement.ManageHostFeatures",
    "ProviderName": "R",
    "ProviderKey": "admin"
  },
  {
    "_id": "SUbPXz4xPl9dhjoTA9TLcw==",
    "TenantId": null,
    "Name": "AbpIdentity.Roles",
    "ProviderName": "R",
    "ProviderKey": "admin"
  },
  {
    "_id": "mKFXoVcRjcZvnToTA9TLpg==",
    "TenantId": null,
    "Name": "AbpIdentity.Roles.Create",
    "ProviderName": "R",
    "ProviderKey": "admin"
  },
  {
    "_id": "1jTtHtqPxPr8kjoTA9TL2g==",
    "TenantId": null,
    "Name": "AbpIdentity.Roles.Update",
    "ProviderName": "R",
    "ProviderKey": "admin"
  },
  {
    "_id": "7+JmBmQviO6h/ToTA9TMDA==",
    "TenantId": null,
    "Name": "AbpIdentity.Roles.Delete",
    "ProviderName": "R",
    "ProviderKey": "admin"
  },
  {
    "_id": "p9ckkHZkC9bnTToTA9TMOg==",
    "TenantId": null,
    "Name": "AbpIdentity.Roles.ManagePermissions",
    "ProviderName": "R",
    "ProviderKey": "admin"
  },
  {
    "_id": "yLgkwH3xonwxjToTA9TMZw==",
    "TenantId": null,
    "Name": "AuditLogging.ViewChangeHistory:Volo.Abp.Identity.IdentityRole",
    "ProviderName": "R",
    "ProviderKey": "admin"
  },
  {
    "_id": "xd8GDO/uLEfD3ToTA9TMmg==",
    "TenantId": null,
    "Name": "AbpIdentity.Users",
    "ProviderName": "R",
    "ProviderKey": "admin"
  },
  {
    "_id": "8aPmwRPHofUdeToTA9TM3A==",
    "TenantId": null,
    "Name": "AbpIdentity.Users.Create",
    "ProviderName": "R",
    "ProviderKey": "admin"
  },
  {
    "_id": "va1T0meKaKUPtDoTA9TNDg==",
    "TenantId": null,
    "Name": "AbpIdentity.Users.Update",
    "ProviderName": "R",
    "ProviderKey": "admin"
  },
  {
    "_id": "oEr8Zcmbdt9tazoTA9TNTA==",
    "TenantId": null,
    "Name": "AbpIdentity.Users.Delete",
    "ProviderName": "R",
    "ProviderKey": "admin"
  },
  {
    "_id": "8F93pNf1YQ7I+ToTA9TNeg==",
    "TenantId": null,
    "Name": "AbpIdentity.Users.ManagePermissions",
    "ProviderName": "R",
    "ProviderKey": "admin"
  },
  {
    "_id": "KueF0MqjHMCdcjoTA9TNrA==",
    "TenantId": null,
    "Name": "AbpIdentity.Users.Update.ManageRoles",
    "ProviderName": "R",
    "ProviderKey": "admin"
  },
  {
    "_id": "8gO5VwpDWb/XOzoTA9TN3A==",
    "TenantId": null,
    "Name": "AbpIdentity.Users.Update.ManageOU",
    "ProviderName": "R",
    "ProviderKey": "admin"
  },
  {
    "_id": "pYlf+G1e7YnptzoTA9TODg==",
    "TenantId": null,
    "Name": "AuditLogging.ViewChangeHistory:Volo.Abp.Identity.IdentityUser",
    "ProviderName": "R",
    "ProviderKey": "admin"
  },
  {
    "_id": "rc3JkV7SwsmjijoTA9TORg==",
    "TenantId": null,
    "Name": "AbpIdentity.Users.Impersonation",
    "ProviderName": "R",
    "ProviderKey": "admin"
  },
  {
    "_id": "jQ4ZAFAAQP4p6ToTA9TOdA==",
    "TenantId": null,
    "Name": "AbpIdentity.Users.Import",
    "ProviderName": "R",
    "ProviderKey": "admin"
  },
  {
    "_id": "m5j2sktuh+lG+ToTA9TOqA==",
    "TenantId": null,
    "Name": "AbpIdentity.Users.Export",
    "ProviderName": "R",
    "ProviderKey": "admin"
  },
  {
    "_id": "Z745DXH0penk1ToTA9TO2A==",
    "TenantId": null,
    "Name": "AbpIdentity.Users.ViewDetails",
    "ProviderName": "R",
    "ProviderKey": "admin"
  },
  {
    "_id": "WozWoKYScwjQ9DoTA9TPCg==",
    "TenantId": null,
    "Name": "AbpIdentity.OrganizationUnits",
    "ProviderName": "R",
    "ProviderKey": "admin"
  }
]

5 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you share a project and some data to reproduce?

    Thanks

    liming.ma@volosoft.com

  • User Avatar
    0
    pelc.stefan created

    email sent, thanks.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Hi

    How can I get a CosmosDB-ConnectionString ?

    Do you know if I can create it in Docker?

    Thanks.

  • User Avatar
    0
    pelc.stefan created

    Hi,

    there is an emulator for hosting a cosmosdb https://learn.microsoft.com/en-us/azure/cosmos-db/emulator

    we are hosting our instances in azure.

    best regards

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    I didn't make it work locally.

    Can you try to override this method to change the query way?

    https://github.com/abpframework/abp/blob/dev/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityRoleRepository.cs#L31-L53

Made with ❤️ on ABP v9.0.0-preview Updated on September 19, 2024, 10:13