You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently request with invalid JSON raises a general exception (such as RuntimeException and JsonParsingException), and it's not handled in the library.
Like an unparseable input document error, it's better to return ExecutionResult with a specific GraphQLError.
java.lang.RuntimeException: Query can not be null
at io.smallrye.graphql.execution.ExecutionService.execute(ExecutionService.java:122)
at io.smallrye.graphql.execution.ExecutionService.executeAsync(ExecutionService.java:104)
at io.quarkus.smallrye.graphql.runtime.SmallRyeGraphQLExecutionHandler.doRequest(SmallRyeGraphQLExecutionHandler.java:305)
at io.quarkus.smallrye.graphql.runtime.SmallRyeGraphQLExecutionHandler.handlePost(SmallRyeGraphQLExecutionHandler.java:121)
at io.quarkus.smallrye.graphql.runtime.SmallRyeGraphQLExecutionHandler.doHandle(SmallRyeGraphQLExecutionHandler.java:82)
at io.quarkus.smallrye.graphql.runtime.SmallRyeGraphQLAbstractHandler.handleWithIdentity(SmallRyeGraphQLAbstractHandler.java:95)
at io.quarkus.smallrye.graphql.runtime.SmallRyeGraphQLAbstractHandler.handle(SmallRyeGraphQLAbstractHandler.java:76)
at io.quarkus.smallrye.graphql.runtime.SmallRyeGraphQLAbstractHandler.handle(SmallRyeGraphQLAbstractHandler.java:30)
at io.vertx.ext.web.impl.BlockingHandlerDecorator.lambda$handle$0(BlockingHandlerDecorator.java:48)
at io.vertx.core.impl.ContextBase.lambda$null$0(ContextBase.java:137)
at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:264)
at io.vertx.core.impl.ContextBase.lambda$executeBlocking$1(ContextBase.java:135)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:833)
javax.json.stream.JsonParsingException: Invalid token=EOF at (line no=1, column no=3, offset=2). Expected tokens are: [STRING, CURLYCLOSE]
at org.glassfish.json.JsonParserImpl.parsingException(JsonParserImpl.java:426)
at org.glassfish.json.JsonParserImpl.access$1100(JsonParserImpl.java:55)
at org.glassfish.json.JsonParserImpl$ObjectContext.getNextEvent(JsonParserImpl.java:446)
at org.glassfish.json.JsonParserImpl.hasNext(JsonParserImpl.java:341)
at org.glassfish.json.JsonParserImpl.getObject(JsonParserImpl.java:310)
at org.glassfish.json.JsonParserImpl.getObject(JsonParserImpl.java:149)
at org.glassfish.json.JsonReaderImpl.readObject(JsonReaderImpl.java:88)
at io.quarkus.smallrye.graphql.runtime.SmallRyeGraphQLExecutionHandler.getJsonObjectFromBody(SmallRyeGraphQLExecutionHandler.java:197)
at io.quarkus.smallrye.graphql.runtime.SmallRyeGraphQLExecutionHandler.handlePost(SmallRyeGraphQLExecutionHandler.java:101)
at io.quarkus.smallrye.graphql.runtime.SmallRyeGraphQLExecutionHandler.doHandle(SmallRyeGraphQLExecutionHandler.java:82)
at io.quarkus.smallrye.graphql.runtime.SmallRyeGraphQLAbstractHandler.handleWithIdentity(SmallRyeGraphQLAbstractHandler.java:95)
at io.quarkus.smallrye.graphql.runtime.SmallRyeGraphQLAbstractHandler.handle(SmallRyeGraphQLAbstractHandler.java:76)
at io.quarkus.smallrye.graphql.runtime.SmallRyeGraphQLAbstractHandler.handle(SmallRyeGraphQLAbstractHandler.java:30)
at io.vertx.ext.web.impl.BlockingHandlerDecorator.lambda$handle$0(BlockingHandlerDecorator.java:48)
at io.vertx.core.impl.ContextBase.lambda$null$0(ContextBase.java:137)
at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:264)
at io.vertx.core.impl.ContextBase.lambda$executeBlocking$1(ContextBase.java:135)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:833)
The text was updated successfully, but these errors were encountered:
We've recently improved handling of invalid requests via #1666
The actual PR #1719 - it returns an ExecutionResult with a GraphQLError saying Unparseable input document
This should be solved in SmallRye GraphQL 2.1.0+, which will be part of Quarkus 3.0. Is this solution sufficient for you?
The two cases I described seems to be different from the issue that has been solved the PR #1719.
My point was that those cases should be also handled in the same way as for unparseable input document error.
As I described as curl command above,
In the latest code 279372f , request with JSON body {} throws RuntimeError at here.
And request with JSON body { throws JsonParsingException. But sorry, that was not smallrye-graphql problem but quarkus-smallrye-graphql)
Currently request with invalid JSON raises a general exception (such as
RuntimeException
andJsonParsingException
), and it's not handled in the library.Like an unparseable input document error, it's better to return
ExecutionResult
with a specificGraphQLError
.1. Request with missing
query
fieldrequest:
throws:
2. Request with broken JSON
request:
throws:
The text was updated successfully, but these errors were encountered: