Skip to content

GraphQL HotChocolate Handles Field Type Overflow as HTTP 500 erroneously #881

@seantleonard

Description

@seantleonard

While resolving #838 (comment), I ran into an issue with how HotChocolate handles type overflow. i.e. this request will result in HTTP 500

mutation deleteJournal{
  deleteJournal(id: 999999999999)
  {
    id,
    journalname
  }
}

with this error:

{
  "errors": [
    {
      "message": "Exception of type 'HotChocolate.Language.InvalidFormatException' was thrown.",
      "extensions": {
        "message": "Exception of type 'HotChocolate.Language.InvalidFormatException' was thrown.",
        "stackTrace": "   at HotChocolate.Language.IntValueNode.ToInt32()\r\n   at HotChocolate.Types.IntType.ParseLiteral(IntValueNode valueSyntax)\r\n   at HotChocolate.Types.IntegerTypeBase`1.IsInstanceOfType(IntValueNode valueSyntax)\r\n   at HotChocolate.Types.ScalarType`2.IsInstanceOfType(IValueNode valueSyntax)\r\n   at HotChocolate.Validation.Rules.ValueVisitor.IsInstanceOfType(IDocumentValidatorContext context, IInputType inputType, IValueNode value)\r\n   at HotChocolate.Validation.Rules.ValueVisitor.Enter(IValueNode valueNode, IDocumentValidatorContext context)\r\n   at HotChocolate.Language.Visitors.SyntaxWalker`1.Enter(ISyntaxNode node, TContext context)\r\n   at HotChocolate.Language.Visitors.SyntaxVisitor`1.Visit[T,P](T node, P parent, TContext context)\r\n   at HotChocolate.Language.Visitors.SyntaxVisitor`1.VisitChildren(ArgumentNode node, TContext context)\r\n   at HotChocolate.Language.Visitors.SyntaxVisitor`1.VisitChildren(ISyntaxNode node, TContext context)\r\n   at HotChocolate.Language.Visitors.SyntaxVisitor`1.Visit[T,P](T node, P parent, TContext context)\r\n   at HotChocolate.Language.Visitors.SyntaxVisitor`1.VisitChildren(FieldNode node, TContext context)\r\n   at HotChocolate.Language.Visitors.SyntaxVisitor`1.VisitChildren(ISyntaxNode node, TContext context)\r\n   at HotChocolate.Language.Visitors.SyntaxVisitor`1.Visit[T,P](T node, P parent, TContext context)\r\n   at HotChocolate.Language.Visitors.SyntaxVisitor`1.VisitChildren(SelectionSetNode node, TContext context)\r\n   at HotChocolate.Language.Visitors.SyntaxVisitor`1.VisitChildren(ISyntaxNode node, TContext context)\r\n   at HotChocolate.Language.Visitors.SyntaxVisitor`1.Visit[T,P](T node, P parent, TContext context)\r\n   at HotChocolate.Language.Visitors.SyntaxVisitor`1.VisitChildren(OperationDefinitionNode node, TContext context)\r\n   at HotChocolate.Language.Visitors.SyntaxVisitor`1.VisitChildren(ISyntaxNode node, TContext context)\r\n   at HotChocolate.Language.Visitors.SyntaxVisitor`1.Visit[T,P](T node, P parent, TContext context)\r\n   at HotChocolate.Validation.DocumentValidatorVisitor.VisitChildren(DocumentNode node, IDocumentValidatorContext context)\r\n   at HotChocolate.Language.Visitors.SyntaxVisitor`1.VisitChildren(ISyntaxNode node, TContext context)\r\n   at HotChocolate.Language.Visitors.SyntaxVisitor`1.Visit[T,P](T node, P parent, TContext context)\r\n   at HotChocolate.Language.Visitors.SyntaxVisitor`1.Visit(ISyntaxNode node, TContext context)\r\n   at HotChocolate.Validation.DocumentValidatorRule`1.Validate(IDocumentValidatorContext context, DocumentNode document)\r\n   at HotChocolate.Validation.DocumentValidator.Validate(ISchema schema, DocumentNode document, IDictionary`2 contextData, Boolean onlyNonCacheable)\r\n   at HotChocolate.Execution.Pipeline.DocumentValidationMiddleware.InvokeAsync(IRequestContext context)\r\n   at HotChocolate.Execution.Pipeline.DocumentParserMiddleware.InvokeAsync(IRequestContext context)\r\n   at HotChocolate.Execution.Pipeline.DocumentCacheMiddleware.InvokeAsync(IRequestContext context)\r\n   at HotChocolate.Execution.Pipeline.TimeoutMiddleware.InvokeAsync(IRequestContext context)\r\n   at HotChocolate.Execution.Pipeline.ExceptionMiddleware.InvokeAsync(IRequestContext context)"
      }
    }
  ]
}

This is currently tracked as a HotChocolate bug here: ChilliCream/graphql-platform#4378

After attempting to create an error filter in HotChocolate to mitigate this issue, I was unable to change the experienced behavior. May need to take another look, get guidance on HC stack overflow, or await their bug fix

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggraphql

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions