[SOLVED] Unknown error in Content API tab

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

When I tap Content API tab in admin UI I see error “Something went wrong…” with description HTTP Error 500. See the screenshots below for details.

No third-party operations were performed. Schemes and content were added as usual. It is not known even after what such an error appeared. This is something with the data and the database, because when I use the local database everything works. Tried deleting schemas that were recently created. No results.
What it can be? How it can be fixed?

Expected behavior

Content APIs descriptions

Minimal reproduction of the problem

Unknown

Environment

  • [ x ] Self hosted with docker
  • [ ] Self hosted with IIS
  • [ ] Self hosted with other version
  • [ ] Cloud version

Version: 5.8.2

Browser:

  • [ ] Chrome (desktop)
  • [ ] Chrome (Android)
  • [ ] Chrome (iOS)
  • [ ] Firefox
  • [ ] Safari (desktop)
  • [ ] Safari (iOS)
  • [ ] IE
  • [ ] Edge

Others:

Please check the logs.

{
  "logLevel": "Error",
  "message": "An unexpected exception has occurred.",
  "timestamp": "2021-11-11T07:38:48Z",
  "app": {
    "name": "Squidex",
    "version": "5.0.0.0",
    "sessionId": "25efcfe9-a12a-44b3-896f-1820e8511953"
  },
  "web": {
    "requestId": "00-ae8373411cc02644b96a9230db5896a8-47f6af884f2bf543-00",
    "requestPath": "/content/{app}/swagger/v1/swagger.json",
    "requestMethod": "GET",
    "routeValues": {
      "area": "Api",
      "action": "GetOpenApi",
      "controller": "ContentOpenApi"
    }
  },
  "exception": {
    "type": "System.ArgumentException",
    "message": "An item with the same key has already been added.",
    "stackTrace": "   at NSwag.Collections.ObservableDictionary\u00602.Insert(TKey key, TValue value, Boolean add)\n   at Squidex.Infrastructure.CollectionExtensions.GetOrAdd[TKey,TValue](IDictionary\u00602 dictionary, TKey key, Func\u00602 creator) in /src/src/Squidex.Infrastructure/CollectionExtensions.cs:line 368\n   at Squidex.Areas.Api.Controllers.Contents.Generator.Builder.ResolveSchema(String name, Func\u00601 factory)\n   at Squidex.Domain.Apps.Core.GenerateJsonSchema.JsonTypeVisitor.BuildComponent(JsonSchema jsonSchema, ImmutableList\u00601 schemaIds, Args args) in /src/src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/JsonTypeVisitor.cs:line 197\n   at Squidex.Domain.Apps.Core.GenerateJsonSchema.JsonTypeVisitor.Visit(IField\u00601 field, Args args) in /src/src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/JsonTypeVisitor.cs:line 102\n   at Squidex.Domain.Apps.Core.GenerateJsonSchema.JsonTypeVisitor.\u003C\u003Ec__DisplayClass18_1.\u003CBuildComponent\u003Eb__1() in /src/src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/JsonTypeVisitor.cs:line 205\n   at Squidex.Infrastructure.CollectionExtensions.GetOrAdd[TKey,TValue](IDictionary\u00602 dictionary, TKey key, Func\u00602 creator) in /src/src/Squidex.Infrastructure/CollectionExtensions.cs:line 368\n   at Squidex.Areas.Api.Controllers.Contents.Generator.Builder.ResolveSchema(String name, Func\u00601 factory)\n   at Squidex.Domain.Apps.Core.GenerateJsonSchema.JsonTypeVisitor.BuildComponent(JsonSchema jsonSchema, ImmutableList\u00601 schemaIds, Args args) in /src/src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/JsonTypeVisitor.cs:line 197\n   at Squidex.Domain.Apps.Core.GenerateJsonSchema.JsonTypeVisitor.Visit(IField\u00601 field, Args args) in /src/src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/JsonTypeVisitor.cs:line 102\n   at Squidex.Domain.Apps.Core.GenerateJsonSchema.JsonTypeVisitor.\u003C\u003Ec__DisplayClass18_1.\u003CBuildComponent\u003Eb__1() in /src/src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/JsonTypeVisitor.cs:line 205\n   at Squidex.Infrastructure.CollectionExtensions.GetOrAdd[TKey,TValue](IDictionary\u00602 dictionary, TKey key, Func\u00602 creator) in /src/src/Squidex.Infrastructure/CollectionExtensions.cs:line 368\n   at Squidex.Areas.Api.Controllers.Contents.Generator.Builder.ResolveSchema(String name, Func\u00601 factory)\n   at Squidex.Domain.Apps.Core.GenerateJsonSchema.JsonTypeVisitor.BuildComponent(JsonSchema jsonSchema, ImmutableList\u00601 schemaIds, Args args) in /src/src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/JsonTypeVisitor.cs:line 197\n   at Squidex.Domain.Apps.Core.GenerateJsonSchema.JsonTypeVisitor.Visit(IField\u00601 field, Args args) in /src/src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/JsonTypeVisitor.cs:line 102\n   at Squidex.Domain.Apps.Core.GenerateJsonSchema.JsonTypeVisitor.\u003C\u003Ec__DisplayClass18_1.\u003CBuildComponent\u003Eb__1() in /src/src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/JsonTypeVisitor.cs:line 205\n   at Squidex.Infrastructure.CollectionExtensions.GetOrAdd[TKey,TValue](IDictionary\u00602 dictionary, TKey key, Func\u00602 creator) in /src/src/Squidex.Infrastructure/CollectionExtensions.cs:line 368\n   at Squidex.Areas.Api.Controllers.Contents.Generator.Builder.ResolveSchema(String name, Func\u00601 factory)\n   at Squidex.Domain.Apps.Core.GenerateJsonSchema.JsonTypeVisitor.BuildComponent(JsonSchema jsonSchema, ImmutableList\u00601 schemaIds, Args args) in /src/src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/JsonTypeVisitor.cs:line 197\n   at Squidex.Domain.Apps.Core.GenerateJsonSchema.JsonTypeVisitor.Visit(IField\u00601 field, Args args) in /src/src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/JsonTypeVisitor.cs:line 102\n   at Squidex.Domain.Apps.Core.GenerateJsonSchema.JsonTypeVisitor.\u003C\u003Ec__DisplayClass18_1.\u003CBuildComponent\u003Eb__1() in /src/src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/JsonTypeVisitor.cs:line 205\n   at Squidex.Infrastructure.CollectionExtensions.GetOrAdd[TKey,TValue](IDictionary\u00602 dictionary, TKey key, Func\u00602 creator) in /src/src/Squidex.Infrastructure/CollectionExtensions.cs:line 368\n   at Squidex.Areas.Api.Controllers.Contents.Generator.Builder.ResolveSchema(String name, Func\u00601 factory)\n   at Squidex.Domain.Apps.Core.GenerateJsonSchema.JsonTypeVisitor.BuildComponent(JsonSchema jsonSchema, ImmutableList\u00601 schemaIds, Args args) in /src/src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/JsonTypeVisitor.cs:line 197\n   at Squidex.Domain.Apps.Core.GenerateJsonSchema.JsonTypeVisitor.Visit(IField\u00601 field, Args args) in /src/src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/JsonTypeVisitor.cs:line 102\n   at Squidex.Domain.Apps.Core.GenerateJsonSchema.JsonSchemaExtensions.BuildDynamicJsonSchema(Schema schema, SchemaResolver schemaResolver, ResolvedComponents components, Boolean withHidden) in /src/src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/JsonSchemaExtensions.cs:line 50\n   at Squidex.Infrastructure.CollectionExtensions.GetOrAdd[TKey,TValue](IDictionary\u00602 dictionary, TKey key, Func\u00602 creator) in /src/src/Squidex.Infrastructure/CollectionExtensions.cs:line 368\n   at Squidex.Areas.Api.Controllers.Contents.Generator.Builder.ResolveSchema(String name, Func\u00601 factory)\n   at Squidex.Areas.Api.Controllers.Contents.Generator.Builder.Schema(Schema schema, ResolvedComponents components, Boolean flat) in /src/src/Squidex/Areas/Api/Controllers/Contents/Generator/Builder.cs:line 131\n   at Squidex.Areas.Api.Controllers.Contents.Generator.SchemasOpenApiGenerator.GenerateAsync(HttpContext httpContext, IAppEntity app, IEnumerable\u00601 schemas, Boolean flat) in /src/src/Squidex/Areas/Api/Controllers/Contents/Generator/SchemasOpenApiGenerator.cs:line 78\n   at Squidex.Areas.Api.Controllers.Contents.ContentOpenApiController.GetOpenApi(String app) in /src/src/Squidex/Areas/Api/Controllers/Contents/ContentOpenApiController.cs:line 70\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)"
  }
}

Okay. can you send me a backup of your App via PM, then I can have a look.

I have a fix ready. The problem is that the UI (Redoc) has a bug, which I cannot fix.

Do you know what is the reason? what led to this

When you have self-referencing json schemas, you get the following exception:

Maximum call stack size exceeded

Seems to be a stackoverflow exception

I tried to understand the Redoc code and provide a fix, but it is not the easiest code.

Can you test docker-tag dev-6458

I don’t quite understand what this should give us.
This will simply denote the image for us. It will not end up in the container.

There is not official release for the bugfix yet, but you can try squidex/squidex:dev-6458 to see if the bugfix works for you.

I have created an issue for the redoc problem with the stackoverflow exception: https://github.com/Redocly/redoc/issues/1792

1 Like

This topic was automatically closed after 2 days. New replies are no longer allowed.