[SOLVED] GraphQL StatusCode 500

I have…

  • [ ] 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 Editor is not responding any more shows only:

{
“statusCode”: 500
}

I have previeously recreated schemas with this
image

I have checked if schema ahs some faults via API, but seems to working fine.

Expected behavior

Minimal reproduction of the problem

Environment

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

Version: [VERSION]

Browser:

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

Others:

Please provide some log,if possible

The logs are not showing any errors. In the logs everything normal, even restarted squidex container spins up normal can do everything beside GraphQL.

Which version are you using?

I’m using 4.1.3 version.

P.S.
This comment field need at least 20 charecters!!

If you have nothing in the logs, you can either upgrade to the current master version or send me a backup of your mongo database and some example queries, otherwise I cannot help.

If you have Microsoft teams we can also have quick connect?
my id: saqib.javed@it-blue.com
In the mean while I will try to upgrade to master. is this the latest version: docker pull squidex/squidex:dev-4040?

No, dev-4050. I cannot help with Microsoft Teams, if there are no logs and nothing to debug, I know as much as you do.

So now with latest version there some log entries.

And I guess I also figured out what the problem is. Some name of a filed is not matching with GraphQL rules.

“2020-03-19T18:59:37Z”}
{“logLevel”:“Error”,“messag”:“An unexpected exception has occurred.”,“app”:{“name”:“Squidex”,“version”:“3.0.0.0”,“sessionId”:“4d3c4678-3d58-4736-acde-ae11387cd9fe”},“web”:{“requestId”:"|e74f2f4a-4a35c7504ac5c7f6.",“requestPath”:"/content/x/graphql",“requestMethod”:“POST”,“routeValues”:{“area”:“Api”,“action”:“PostGraphQL”,“controller”:“Contents”}},“timestamp”:“2020-03-19T18:59:41Z”,“exception”:{“type”:“System.ArgumentOutOfRangeException”,“message”:“A field name must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but 2Hour does not. (Parameter \u0027name\u0027)”,“stackTrace”:" at GraphQL.Utilities.NameValidator.ValidateName(String name, String type)\n at GraphQL.Types.ComplexGraphType\u00601.AddField(FieldType fieldType)\n at Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.NestedGraphType…ctor(IGraphModel model, ISchemaEntity schema, IArrayField field, String fieldName) in /src/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/NestedGraphType.cs:line 27\n at Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.QueryGraphTypeVisitor.ResolveNested(IArrayField field) in /src/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/QueryGraphTypeVisitor.cs:line 100\n at Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.QueryGraphTypeVisitor.Visit(IArrayField field) in /src/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/QueryGraphTypeVisitor.cs:line 45\n at Squidex.Domain.Apps.Core.Schemas.ArrayFieldProperties.Accept[T](IFieldVisitor\u00601 visitor, IField field) in /src/src/Squidex.Domain.Apps.Core.Model/Schemas/ArrayFieldProperties.cs:line 26\n at Squidex.Domain.Apps.Core.Schemas.RootField\u00601.Accept[TResult](IFieldVisitor\u00601 visitor) in /src/src/Squidex.Domain.Apps.Core.Model/Schemas/RootField{T}.cs:line 70\n at Squidex.Domain.Apps.Entities.Contents.GraphQL.GraphQLModel.GetGraphType(ISchemaEntity schema, IField field, String fieldName) in /src/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/GraphQLModel.cs:line 151\n at Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.ContentDataGraphType…ctor(ISchemaEntity schema, String schemaName, String schemaType, IGraphModel model) in /src/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/ContentDataGraphType.cs:line 27\n at Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.ContentGraphType.Initialize(IGraphModel model) in /src/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/ContentGraphType.cs:line 119\n at Squidex.Domain.Apps.Entities.Contents.GraphQL.GraphQLModel.InitializeContentTypes() in /src/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/GraphQLModel.cs:line 75\n at Squidex.Domain.Apps.Entities.Contents.GraphQL.GraphQLModel…ctor(IAppEntity app, IEnumerable\u00601 schemas, Int32 pageSizeContents, Int32 pageSizeAssets, IUrlGenerator urlGenerator) in /src/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/GraphQLModel.cs:line 63\n at Squidex.Domain.Apps.Entities.Contents.GraphQL.CachingGraphQLService.\u003C\u003Ec__DisplayClass6_0.\u003C\u003CGetModelAsync\u003Eb__0\u003Ed.MoveNext() in /src/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/CachingGraphQLService.cs:line 92\n— End of stack trace from previous location where exception was thrown —\n at Microsoft.Extensions.Caching.Memory.CacheExtensions.GetOrCreateAsync[TItem](IMemoryCache cache, Object key, Func\u00602 factory)\n at Squidex.Domain.Apps.Entities.Contents.GraphQL.CachingGraphQLService.QueryAsync(Context context, GraphQLQuery query) in /src/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/CachingGraphQLService.cs:line 54\n at Squidex.Areas.Api.Controllers.Contents.ContentsController.PostGraphQL(String app, GraphQLQuery query) in /src/src/Squidex/Areas/Api/Controllers/Contents/ContentsController.cs:line 61\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)"}}

Yes, thats correct. I can provide a fix, but that would mean to prefix the field with something in graphql.

I renamed the fields which causes the problems. But would be good to have validation step when creating field names via UI or synchronizing via JSON menu.

1 Like

They are validation steps, but we use a different schema for field names than GraphQL. I could change that but I am not sure what compatibility issues this would cause.

GraphQL field names:

^[_a-zA-Z][_a-zA-Z0-9]*$

vs Squidex fields

^[a-zA-Z0-9]+(\\-[a-zA-Z0-9]+)*$
1 Like

I Have fixed this by prefixed problematic fields with gql. I will consider to update the field name regex, but I need to be sure about compatibility.

1 Like

I have pushed a fix, that pefixes problematic fields with gql_