[SOLVED] GraphQL 500 Status Code with multi-level components

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

GraphQL fails to load

Expected behavior

GraphQL loads with document explorer

Minimal reproduction of the problem

Set up a reproduction at https://cloud.squidex.io/app/graphql-bug

Basically steps are as follows.

  1. Create schema-1 (string)
  2. Create component-1 (string, and reference to schema-1 allowing 1 to n)
  3. Create component-2 (component to component-1)
  4. Create schema-2 (component to component-2)

This setup works without the creation of component-2. However, when creating a component that accesses another component, graphql appears to break down with a 500 error and returns the error Collection was modified; enumeration operation may not execute.

Log to published in next post.

Environment

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

Version: latest in both cloud and self-hosted

Browser:

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

Others:

{
  "logLevel": "Error",
  "message": "An unexpected exception has occurred.",
  "timestamp": "2021-06-30T20:27:20Z",
  "app": {
    "name": "Squidex",
    "version": "5.0.0.0",
    "sessionId": "e181d8a0-981a-41a8-a9f2-d5217372b907"
  },
  "web": {
    "requestId": "00-68a9e86630bcf149b06eb56b5d6f5b80-a56cb8d7be41c44a-00",
    "requestPath": "/content/brand/graphql",
    "requestMethod": "POST",
    "routeValues": {
      "area": "Api",
      "action": "GetGraphQL",
      "controller": "Contents"
    }
  },
  "exception": {
    "type": "System.InvalidOperationException",
    "message": "Collection was modified; enumeration operation may not execute.",
    "stackTrace": "   at System.Collections.Generic.Dictionary\\u00602.Enumerator.MoveNext()\\n   at Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.Builder.BuildSchema(IEnumerable\\u00601 schemas) in /src/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Builder.cs:line 91\\n   at Squidex.Domain.Apps.Entities.Contents.GraphQL.GraphQLModel..ctor(IAppEntity app, IEnumerable\\u00601 schemas, SharedTypes typeFactory, ISemanticLog log) in /src/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/GraphQLModel.cs:line 32\\n   at Squidex.Domain.Apps.Entities.Contents.GraphQL.CachingGraphQLService.CreateModelAsync(IAppEntity app) in /src/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/CachingGraphQLService.cs:line 92\\n   at Squidex.Domain.Apps.Entities.Contents.GraphQL.CachingGraphQLService.\\u003C\\u003Ec__DisplayClass11_0.\\u003C\\u003CGetModelEntryAsync\\u003Eb__0\\u003Ed.MoveNext() in /src/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/CachingGraphQLService.cs:line 76\\n--- End of stack trace from previous location ---\\n   at Squidex.Domain.Apps.Entities.Contents.GraphQL.CachingGraphQLService.GetModelAsync(IAppEntity app) in /src/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/CachingGraphQLService.cs:line 60\\n   at Squidex.Domain.Apps.Entities.Contents.GraphQL.CachingGraphQLService.ExecuteAsync(ExecutionOptions options) in /src/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/CachingGraphQLService.cs:line 53\\n   at GraphQL.Server.DefaultGraphQLExecuter\\u00601.ExecuteAsync(String operationName, String query, Inputs variables, IDictionary\\u00602 context, IServiceProvider requestServices, CancellationToken cancellationToken) in /_/src/Core/DefaultGraphQLExecuter.cs:line 44\\n   at GraphQL.Server.Transports.AspNetCore.GraphQLHttpMiddleware\\u00601.InvokeAsync(HttpContext context) in /_/src/Transports.AspNetCore/GraphQLHttpMiddleware.cs:line 138\\n   at lambda_method3975(Closure , Object )\\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableResultExecutor.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)"
  }
}

Produced a slightly simpler example as well with the component not having a reference field to a schema.

The app is in the cloud at https://cloud.squidex.io/app/graphql-bug-take-2/

Same issue it appears. This one was…

  1. Component-1 (string)
  2. Component-2 (component to Component-1)
  3. Schema (component to Component-2)

@Sebastian We just updated to the latest version locally and noticed you pushed a graphql fix. Just wanted to confirm to you that your update fixed the bug I was seeing yesterday.

Thank you for your help.

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