graphene-sqlalchemy icon indicating copy to clipboard operation
graphene-sqlalchemy copied to clipboard

Received incompatible instance \"<coroutine object get_batch_resolver.<locals>.resolve at 0x1080d6840>

Open raguiar2 opened this issue 4 years ago • 2 comments

When following the tutorial at https://docs.graphene-python.org/projects/sqlalchemy/en/latest/tutorial/ and using the following packages

asgiref==3.4.1
Flask==2.0.2
graphene==3.0
graphene-sqlalchemy==3.0.0b1
graphql-core==3.1.6
graphql-server[flask]==3.0.0b4
graphql-relay==3.1.0
uvicorn==0.16.0
gunicorn==20.1.0

to run an ASGI uvicorn server with flask (though it doesn't work if i just type flask run either), I execute the graphql command

{
  allEmployees {
    edges {
      node {
        id
        name
        department {
          name
        }
      }
    }
  }
}

And get a bunch of errors that say: Received incompatible instance \"<coroutine object get_batch_resolver.<locals>.resolve at 0x1080d6840>

I looked deeper into it and it looks like the batch_load_fn in the batching.py file might not be awaited. Is this an error on the flask end? My code itself is exactly the same as the tutorials.

raguiar2 avatar Dec 09 '21 20:12 raguiar2

Was able to reproduce this issue in a similar case using FastAPI and graphene-starlette3. Seems to be non-breaking with regards to query resolution though. Has anyone found any fix to that yet?

erikwrede avatar Dec 24 '21 00:12 erikwrede

TODO: re-check with #169 merged, might be a suppressed underlying SQLAlchemy exception.

erikwrede avatar Apr 28 '22 16:04 erikwrede

The graphene-SQLAlchemy part of this issue should be solved with the latest dataloader changes. To support async dataloaders, you need to make sure to use an asyncio-compatible server library such as starlettewith starlette-graphene3, or customize the flask GraphQLView of graphql-server to support an event loop.

erikwrede avatar Feb 15 '23 10:02 erikwrede

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related topics referencing this issue.

github-actions[bot] avatar Aug 15 '23 00:08 github-actions[bot]