[SOLVED] Schema with name asset breaks graphql API

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…

  • [X ] Regression (a behavior that stopped working in a new release)
  • [ ] Bug report
  • [ ] Performance issue
  • [ ] Documentation issue or request

Current behavior

Version 5.4.0 and 5.6.0
GraphQL schema introspection failed when there is a schema with the name asset in the app.
I did not have an issue with this on version 4.6.0.

Expected behavior

Minimal reproduction of the problem

Create an app that has a schema named asset in version 4.6.0 and then update the squidex version to 5.4.0

Environment

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

Version: [VERSION]

Browser:

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

Others:
Error log from the application
{
“logLevel”: “Error”,
“message”: “An unexpected exception has occurred.”,
“timestamp”: “2021-03-15T20:57:07Z”,
“app”: {
“name”: “Squidex”,
“version”: “5.6.0.0”,
“sessionId”: “f0815114-b451-4d84-a4dc-629e21a2cd5a”
},
“web”: {
“requestId”: “00-1e66d841aae66a4582c74cb4db4c8d5c-cd4c3f0fb7664440-00”,
“requestPath”: “/content/fancy/graphql”,
“requestMethod”: “POST”,
“routeValues”: {
“area”: “Api”,
“action”: “GetGraphQL”,
“controller”: “Contents”
}
},
“exception”: {
“type”: “System.InvalidOperationException”,
“message”: “Unable to register GraphType \u0027Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.Contents.ContentGraphType\u0027 with the name \u0027Asset\u0027;\nthe name \u0027Asset\u0027 is already registered to \u0027Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.Assets.AssetGraphType\u0027.”,
“stackTrace”: " at GraphQL.Types.GraphTypesLookup.SetGraphType(String typeName, IGraphType type) in //src/GraphQL/Types/GraphTypesLookup.cs:line 618\n at GraphQL.Types.GraphTypesLookup.AddType(IGraphType type, TypeCollectionContext context) in //src/GraphQL/Types/GraphTypesLookup.cs:line 307\n at GraphQL.Types.GraphTypesLookup.Create(IEnumerable\u00601 types, IEnumerable\u00601 directives, Func\u00602 resolveType, INameConverter nameConverter, Boolean seal) in //src/GraphQL/Types/GraphTypesLookup.cs:line 142\n at GraphQL.Types.Schema.CreateTypesLookup() in //src/GraphQL/Types/Schema.cs:line 336\n at System.Lazy\u00601.ViaFactory(LazyThreadSafetyMode mode)\n at System.Lazy\u00601.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)\n at System.Lazy\u00601.CreateValue()\n at GraphQL.Types.Schema.FindType(String name) in //src/GraphQL/Types/Schema.cs:line 255\n at GraphQL.Types.Schema.Initialize() in //src/GraphQL/Types/Schema.cs:line 80\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 100\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 30\n at Squidex.Domain.Apps.Entities.Contents.GraphQL.CachingGraphQLService.CreateModelAsync(IAppEntity app) in /src/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/CachingGraphQLService.cs:line 97\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 81\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 65\n at Squidex.Domain.Apps.Entities.Contents.GraphQL.CachingGraphQLService.ExecuteAsync(ExecutionOptions options) in /src/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/CachingGraphQLService.cs:line 58\n at GraphQL.Server.Internal.DefaultGraphQLExecuter\u00601.ExecuteAsync(String operationName, String query, Inputs variables, IDictionary\u00602 context, IServiceProvider requestServices, CancellationToken cancellationToken) in //src/Core/Internal/DefaultGraphQLExecuter.cs:line 46\n at GraphQL.Server.Transports.AspNetCore.GraphQLHttpMiddleware\u00601.InvokeAsync(HttpContext context) in //src/Transports.AspNetCore/GraphQLHttpMiddleware.cs:line 144\n at lambda_method2224(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)"
}
}

If you have the 4.X running: Do you remember how the asset type was called in this version?

I have 4.x version running on the other environment. The schema name is asset, and the graphql function names queryAssetContents, findAssetContent etc…

I mean what is the type name for an asset

Sorry, I don’t understand what you asking for.

Does not matter. It is fixed in dev-5742

1 Like

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