question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Query error not handled with v3.0b7

See original GitHub issue

Hello,

First of all thanks for developing Graphene, it is great to bring GraphQL to the Python world!

  • What is the current behavior?

I am running the following code (coming from the Starlette docs) with Starlette, Uvicorn and Graphene v3.0b7:

from starlette.applications import Starlette
from starlette.routing import Route
from starlette.graphql import GraphQLApp
import graphene


class Query(graphene.ObjectType):
    hello = graphene.String(name=graphene.String(default_value="stranger"))

    def resolve_hello(self, info, name):
        return "Hello " + name


routes = [Route("/", GraphQLApp(schema=graphene.Schema(query=Query)))]

app = Starlette(routes=routes)

To run it I use:

uvicorn main:app

Then I send the following query:

query {
  foo
}

And instead of the error message, I get an Internal server error and the following traceback:

ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/home/adrien/.virtualenvs/graphqlapp3/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py", line 394, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/home/adrien/.virtualenvs/graphqlapp3/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__
    return await self.app(scope, receive, send)
  File "/home/adrien/.virtualenvs/graphqlapp3/lib/python3.8/site-packages/starlette/applications.py", line 112, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/adrien/.virtualenvs/graphqlapp3/lib/python3.8/site-packages/starlette/middleware/errors.py", line 181, in __call__
    raise exc from None
  File "/home/adrien/.virtualenvs/graphqlapp3/lib/python3.8/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/home/adrien/.virtualenvs/graphqlapp3/lib/python3.8/site-packages/starlette/exceptions.py", line 82, in __call__
    raise exc from None
  File "/home/adrien/.virtualenvs/graphqlapp3/lib/python3.8/site-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/home/adrien/.virtualenvs/graphqlapp3/lib/python3.8/site-packages/starlette/routing.py", line 582, in __call__
    await route.handle(scope, receive, send)
  File "/home/adrien/.virtualenvs/graphqlapp3/lib/python3.8/site-packages/starlette/routing.py", line 243, in handle
    await self.app(scope, receive, send)
  File "/home/adrien/.virtualenvs/graphqlapp3/lib/python3.8/site-packages/starlette/graphql.py", line 52, in __call__
    response = await self.handle_graphql(request)
  File "/home/adrien/.virtualenvs/graphqlapp3/lib/python3.8/site-packages/starlette/graphql.py", line 105, in handle_graphql
    [format_graphql_error(err) for err in result.errors]
  File "/home/adrien/.virtualenvs/graphqlapp3/lib/python3.8/site-packages/starlette/graphql.py", line 105, in <listcomp>
    [format_graphql_error(err) for err in result.errors]
TypeError: 'NoneType' object is not callable
  • What is the expected behavior?

With Graphene v2.1.8, the same query returns the expected error message:

{
  "data": null,
  "errors": [
    {
      "message": "Cannot query field \"foo\" on type \"Query\".",
      "locations": [
        {
          "line": 2,
          "column": 2
        }
      ]
    }
  ]
}
  • Please tell us about your environment:

Here is my environment:

aniso8601==8.1.0
click==7.1.2
graphene==3.0b7
graphql-core==3.1.2
graphql-relay==3.0.0
h11==0.12.0
starlette==0.14.1
uvicorn==0.13.3

I am on Ubuntu 20.04

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Citocommented, Mar 2, 2021

Starlett also references this in the docs, similar problem here.

0reactions
erikwredecommented, Jun 29, 2022

Closing this issue due to lack of activity. If further problems occur using the new starlette-graphene3 extension, please open up an issue in that repo.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Handling operation errors - Apollo GraphQL Docs
These are errors related to the server-side execution of a GraphQL operation. They include: Syntax errors (e.g., a query was malformed); Validation errors...
Read more >
Unity 2018.3.0b7
Unity 2018.3.0b7 download and release notes. ... Editor: Fixed issue with .spm models not showing up while filetering through project search bar (1082272, ......
Read more >
React Query Error Handling | TkDodo's blog
Here, we're handling error situations by checking for the isError boolean flag (which is derived from the status enum) given to us by...
Read more >
What's new in Unity 2019.3.0 Beta 7 - Unity
New 2019.3.0b7 Entries since 2019.3.0b6. Fixes. Android: Fixed a performance issue where handling suboptimal swapchain as error causes frame drop.
Read more >
CodeIgniter SQL query error handling - Stack Overflow
for what you need it? post is not about debuging sql query, but handling errors :) – Itsmeromka. Mar 30, 2013 at 23:42....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found