I have…
- [x] Checked the logs and have uploaded a log file and provided a link because I found something suspicious there. Please do not post the log file in the topic because very often something important is missing.
I’m submitting a…
- [ ] Regression (a behavior that stopped working in a new release)
- [x] Bug report
- [ ] Performance issue
- [ ] Documentation issue or request
Current behavior
Adding a contributor gives server error. Exception:
2021-01-05T10:51:12.244732691Z {
2021-01-05T10:51:12.244849994Z "logLevel": "Error",
2021-01-05T10:51:12.244857594Z "message": "An unexpected exception has occurred.",
2021-01-05T10:51:12.244931796Z "app": {
2021-01-05T10:51:12.244936596Z "name": "Squidex",
2021-01-05T10:51:12.244940896Z "version": "5.2.1.0",
2021-01-05T10:51:12.245090800Z "sessionId": "a53f6a72-bde6-4c90-9e95-5ebabf530a3d"
2021-01-05T10:51:12.245097600Z },
2021-01-05T10:51:12.245101600Z "web": {
2021-01-05T10:51:12.245105700Z "requestId": "|7e34506c-4654320a0a323e37.",
2021-01-05T10:51:12.245110001Z "requestPath": "/apps/nurofy-content/contributors",
2021-01-05T10:51:12.245114401Z "requestMethod": "POST",
2021-01-05T10:51:12.245118601Z "routeValues": {
2021-01-05T10:51:12.245122601Z "area": "Api",
2021-01-05T10:51:12.245126701Z "action": "PostContributor",
2021-01-05T10:51:12.245160602Z "controller": "AppContributors"
2021-01-05T10:51:12.245169502Z }
2021-01-05T10:51:12.245173702Z },
2021-01-05T10:51:12.245177702Z "timestamp": "2021-01-05T10:51:12Z",
2021-01-05T10:51:12.245186903Z "exception": {
2021-01-05T10:51:12.245191303Z "type": "Squidex.Infrastructure.States.InconsistentStateException",
2021-01-05T10:51:12.245204703Z "message": "Requested version 45, but found -1.",
2021-01-05T10:51:12.245417508Z "stackTrace": " at Squidex.Infrastructure.States.Persistence\u00602.WriteEventsAsync(IEnumerable\u00601 events) in /src/src/Squidex.Infrastructure/States/Persistence{TSnapshot,TKey}.cs:line 171\n at Squidex.Infrastructure.Commands.DomainObject\u00601.WriteAsync(Envelope\u00601[] newEvents, Int64 previousVersion) in /src/src/Squidex.Infrastructure/Commands/DomainObject.cs:line 71\n at Squidex.Infrastructure.Commands.DomainObjectBase\u00601.InvokeAsync[TCommand](TCommand command, Func\u00602 handler, Boolean isUpdate) in /src/src/Squidex.Infrastructure/Commands/DomainObjectBase.cs:line 199\n at Squidex.Infrastructure.Commands.DomainObjectGrain\u00602.ExecuteAsync(J\u00601 request) in /src/src/Squidex.Infrastructure/Commands/DomainObjectGrain.cs:line 47\n at Squidex.Domain.Apps.Entities.Apps.OrleansCodeGenAppGrainMethodInvoker.Invoke(IAddressable grain, InvokeMethodRequest request) in /src/src/Squidex.Domain.Apps.Entities/obj/Release/netcoreapp3.1/Squidex.Domain.Apps.Entities.orleans.g.cs:line 35\n at Orleans.Runtime.GrainMethodInvoker.Invoke()\n at Squidex.Infrastructure.Orleans.StateFilter.Invoke(IIncomingGrainCallContext context) in /src/src/Squidex.Infrastructure/Orleans/StateFilter.cs:line 51\n at Orleans.Runtime.GrainMethodInvoker.Invoke()\n at Squidex.Infrastructure.Orleans.LocalCacheFilter.Invoke(IIncomingGrainCallContext context) in /src/src/Squidex.Infrastructure/Orleans/LocalCacheFilter.cs:line 39\n at Orleans.Runtime.GrainMethodInvoker.Invoke()\n at Orleans.Runtime.GrainMethodInvoker.Invoke()\n at Squidex.Infrastructure.Orleans.ExceptionWrapperFilter.Invoke(IIncomingGrainCallContext context) in /src/src/Squidex.Infrastructure/Orleans/ExceptionWrapperFilter.cs:line 35\n at Orleans.Runtime.GrainMethodInvoker.Invoke()\n at Squidex.Infrastructure.Orleans.LoggingFilter.Invoke(IIncomingGrainCallContext context) in /src/src/Squidex.Infrastructure/Orleans/LoggingFilter.cs:line 46\n at Orleans.Runtime.GrainMethodInvoker.Invoke()\n at OrleansDashboard.Metrics.GrainProfilerFilter.Invoke(IIncomingGrainCallContext context)\n at Orleans.Runtime.GrainMethodInvoker.Invoke()\n at Orleans.Runtime.InsideRuntimeClient.Invoke(IAddressable target, IInvokable invokable, Message message)\n at Orleans.Internal.OrleansTaskExtentions.\u003CToTypedTask\u003Eg__ConvertAsync|4_0[T](Task\u00601 asyncTask)\n at Squidex.Infrastructure.Commands.GrainCommandMiddleware\u00602.ExecuteCommandAsync(TCommand typedCommand) in /src/src/Squidex.Infrastructure/Commands/GrainCommandMiddleware.cs:line 45\n at Squidex.Infrastructure.Commands.GrainCommandMiddleware\u00602.ExecuteCommandAsync(CommandContext context) in /src/src/Squidex.Infrastructure/Commands/GrainCommandMiddleware.cs:line 35\n at Squidex.Domain.Apps.Entities.Apps.AppCommandMiddleware.HandleAsync(CommandContext context, NextDelegate next) in /src/src/Squidex.Domain.Apps.Entities/Apps/AppCommandMiddleware.cs:line 50\n at Squidex.Domain.Apps.Entities.Schemas.Indexes.SchemasIndex.HandleAsync(CommandContext context, NextDelegate next) in /src/src/Squidex.Domain.Apps.Entities/Schemas/Indexes/SchemasIndex.cs:line 155\n at Squidex.Domain.Apps.Entities.Rules.Indexes.RulesIndex.HandleAsync(CommandContext context, NextDelegate next) in /src/src/Squidex.Domain.Apps.Entities/Rules/Indexes/RulesIndex.cs:line 61\n at Squidex.Domain.Apps.Entities.Apps.Indexes.AppsIndex.HandleAsync(CommandContext context, NextDelegate next) in /src/src/Squidex.Domain.Apps.Entities/Apps/Indexes/AppsIndex.cs:line 223\n at Squidex.Domain.Apps.Entities.Apps.Invitation.InviteUserCommandMiddleware.HandleAsync(CommandContext context, NextDelegate next) in /src/src/Squidex.Domain.Apps.Entities/Apps/Invitation/InviteUserCommandMiddleware.cs:line 58\n at Squidex.Infrastructure.Commands.CustomCommandMiddlewareRunner.HandleAsync(CommandContext context, NextDelegate next) in /src/src/Squidex.Infrastructure/Commands/CustomCommandMiddlewareRunner.cs:line 32\n at Squidex.Web.CommandMiddlewares.ETagCommandMiddleware.HandleAsync(CommandContext context, NextDelegate next) in /src/src/Squidex.Web/CommandMiddlewares/ETagCommandMiddleware.cs:line 57\n at Squidex.Infrastructure.Commands.InMemoryCommandBus.PublishAsync(ICommand command) in /src/src/Squidex.Infrastructure/Commands/InMemoryCommandBus.cs:line 73\n at Squidex.Areas.Api.Controllers.Apps.AppContributorsController.InvokeCommandAsync(ICommand command) in /src/src/Squidex/Areas/Api/Controllers/Apps/AppContributorsController.cs:line 139\n at Squidex.Areas.Api.Controllers.Apps.AppContributorsController.PostContributor(String app, AssignContributorDto request) in /src/src/Squidex/Areas/Api/Controllers/Apps/AppContributorsController.cs:line 87\n at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.\u003CInvokeActionMethodAsync\u003Eg__Awaited|12_0(ControllerActionInvoker invoker, ValueTask\u00601 actionResultValueTask)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.\u003CInvokeNextActionFilterAsync\u003Eg__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State\u0026 next, Scope\u0026 scope, Object\u0026 state, Boolean\u0026 isCompleted)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.\u003CInvokeInnerFilterAsync\u003Eg__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.\u003CInvokeNextExceptionFilterAsync\u003Eg__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)"
2021-01-05T10:51:12.245460610Z }
2021-01-05T10:51:12.245465510Z }
Expected behavior
User will be added as contributor without error.
Minimal reproduction of the problem
Add a contributor to a project.
Environment
(Azure App Service)
- [x] Self hosted with docker
- [ ] Self hosted with IIS
- [ ] Self hosted with other version
- [ ] Cloud version
Version: 5.2.1
Browser:
- [x] Chrome (desktop)
- [ ] Chrome (Android)
- [ ] Chrome (iOS)
- [ ] Firefox
- [ ] Safari (desktop)
- [ ] Safari (iOS)
- [ ] IE
- [ ] Edge
Others:
I have tried to upgrade and rerun migrations (by decreasing version to 21) with version 5.3.0 and 5.4.0, but this results in the following exception:
2021-01-05T10:46:23.883422831Z {
2021-01-05T10:46:23.883502834Z "logLevel": "Fatal",
2021-01-05T10:46:23.883513834Z "action": "Migration",
2021-01-05T10:46:23.883529534Z "status": "Failed",
2021-01-05T10:46:23.883533734Z "migrator": "Migrations.Migrations.MongoDb.ConvertDocumentIds(Assets)",
2021-01-05T10:46:23.883537834Z "app": {
2021-01-05T10:46:23.883541735Z "name": "Squidex",
2021-01-05T10:46:23.883557835Z "version": "5.4.0.0",
2021-01-05T10:46:23.884131850Z "sessionId": "a78753ce-ae33-4587-b8dd-6a333aed168e"
2021-01-05T10:46:23.884143850Z },
2021-01-05T10:46:23.884161951Z "timestamp": "2021-01-05T10:46:23Z",
2021-01-05T10:46:23.884166251Z "exception": {
2021-01-05T10:46:23.884209652Z "type": "System.InvalidCastException",
2021-01-05T10:46:23.884215852Z "message": "Unable to cast object of type \u0027MongoDB.Bson.BsonString\u0027 to type \u0027MongoDB.Bson.BsonBinaryData\u0027.",
2021-01-05T10:46:23.884865169Z "stackTrace": " at MongoDB.Bson.BsonValue.get_AsGuid()\n at Migrations.Migrations.MongoDb.ConvertDocumentIds.ConvertParentId(BsonDocument document) in /src/src/Migrations/Migrations/MongoDb/ConvertDocumentIds.cs:line 153\n at Migrations.Migrations.MongoDb.ConvertDocumentIds.\u003C\u003Ec__DisplayClass9_0.\u003C\u003CRebuildAsync\u003Eb__0\u003Ed.MoveNext() in /src/src/Migrations/Migrations/MongoDb/ConvertDocumentIds.cs:line 119\n--- End of stack trace from previous location ---\n at Migrations.Migrations.MongoDb.ConvertDocumentIds.RebuildAsync(IMongoDatabase database, Action\u00601 extraAction, String collectionNameOld) in /src/src/Migrations/Migrations/MongoDb/ConvertDocumentIds.cs:line 146\n at Migrations.Migrations.MongoDb.ConvertDocumentIds.UpdateAsync() in /src/src/Migrations/Migrations/MongoDb/ConvertDocumentIds.cs:line 62\n at Squidex.Infrastructure.Migrations.Migrator.MigrateAsync(CancellationToken ct) in /src/src/Squidex.Infrastructure/Migrations/Migrator.cs:line 76"
2021-01-05T10:46:23.884920770Z }
2021-01-05T10:46:23.884939271Z }
2021-01-05T10:46:23.884955071Z
2021-01-05T10:46:23.933722833Z Unhandled exception. Squidex.Infrastructure.Migrations.MigrationFailedException: Failed to run migration 'Migrations.Migrations.MongoDb.ConvertDocumentIds(Assets)'
2021-01-05T10:46:23.933781435Z ---> System.InvalidCastException: Unable to cast object of type 'MongoDB.Bson.BsonString' to type 'MongoDB.Bson.BsonBinaryData'.
2021-01-05T10:46:23.933789435Z at MongoDB.Bson.BsonValue.get_AsGuid()
2021-01-05T10:46:23.933793435Z at Migrations.Migrations.MongoDb.ConvertDocumentIds.ConvertParentId(BsonDocument document) in /src/src/Migrations/Migrations/MongoDb/ConvertDocumentIds.cs:line 153
2021-01-05T10:46:23.933797335Z at Migrations.Migrations.MongoDb.ConvertDocumentIds.<>c__DisplayClass9_0.<<RebuildAsync>b__0>d.MoveNext() in /src/src/Migrations/Migrations/MongoDb/ConvertDocumentIds.cs:line 119
2021-01-05T10:46:23.933801735Z --- End of stack trace from previous location ---
2021-01-05T10:46:23.933805435Z at Migrations.Migrations.MongoDb.ConvertDocumentIds.RebuildAsync(IMongoDatabase database, Action`1 extraAction, String collectionNameOld) in /src/src/Migrations/Migrations/MongoDb/ConvertDocumentIds.cs:line 146
2021-01-05T10:46:23.933809536Z at Migrations.Migrations.MongoDb.ConvertDocumentIds.UpdateAsync() in /src/src/Migrations/Migrations/MongoDb/ConvertDocumentIds.cs:line 62
2021-01-05T10:46:23.933814736Z at Squidex.Infrastructure.Migrations.Migrator.MigrateAsync(CancellationToken ct) in /src/src/Squidex.Infrastructure/Migrations/Migrator.cs:line 76
2021-01-05T10:46:23.933846637Z --- End of inner exception stack trace ---
2021-01-05T10:46:23.933855137Z at Squidex.Infrastructure.Migrations.Migrator.MigrateAsync(CancellationToken ct) in /src/src/Squidex.Infrastructure/Migrations/Migrator.cs:line 86
2021-01-05T10:46:23.933880537Z at Squidex.Infrastructure.Migrations.Migrator.MigrateAsync(CancellationToken ct) in /src/src/Squidex.Infrastructure/Migrations/Migrator.cs:line 97
2021-01-05T10:46:23.933884938Z at Squidex.Config.Startup.SafeHostedService.StartAsync(CancellationToken cancellationToken) in /src/src/Squidex/Config/Startup/SafeHostedService.cs:line 27
2021-01-05T10:46:23.933889038Z at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
2021-01-05T10:46:23.933892938Z at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
2021-01-05T10:46:23.933898338Z at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
2021-01-05T10:46:23.933902238Z at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)