Skip to content

Troubleshoot graphene common errors

entity doesn't have a connection

./object_types.py

    1. check the type definition, he should extend to graphene.ObjectType
    1. Ensure you don't have a typo in meta fields:
py
class Meta:
        model = MyModel
        interfaces = (Node) # graphene.relay.Node
        filterset_class = MyFilterSet
        fields = "__all__"

schema/__init__.py

    1. In the Query class definition, check your fields to ensuire you are using the right connection field !

'WSGIRequest' object has no attribute 'xxxx'

That's probably mean that your request context are invalid.

The call from request will be :

  • Your GQL Query/Mutation -> schema/.your_entity.py def mutate_and_get_payload
  • inside mutate_and_get_payload we passe the info to your serialize context like this : serializer = LabelSerializer(instance=instance, data=input, context={"info": info})
  • And then in object_type when the resolver using this custom attribute will be reach, the rais will occured.

Ensure that you have properly setup your custom loaders before doing the request, in the graphene middleware config for example!

py

GRAPHENE = {
    ...
     "MIDDLEWARE": ["api.middlewares.LoaderMiddleware"],
}