Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
raguiar2 opened this issue Dec 9, 2021 · 4 comments

Comments

@raguiar2
Copy link

raguiar2 commented Dec 9, 2021

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.

@erikwrede
Copy link
Member

erikwrede commented Dec 24, 2021

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
Copy link
Member

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

@erikwrede
Copy link
Member

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.

@github-actions
Copy link

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 github-actions bot locked as resolved and limited conversation to collaborators Aug 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants