`def resolve_xxx()` causing `missing 2 required positional`
See original GitHub issueHello ! I just started to play with graphene-django, so it my be a dummy question. I’m following the “getting started” guide, and want to filter my model, so I’m using the following code:
class Query(ObjectType):
user = relay.Node.Field(UserNode)
all_users = DjangoFilterConnectionField(UserNode)
def resolve_all_users(self, args, context, info):
return DashboardUser.objects.get(user=context.user).team
schema = Schema(query=Query)
However, I got the following error : TypeError: resolve_all_users() missing 2 required positional arguments: 'context' and 'info'
According to the documentation, I should use GraphQLView
, and that is the case.
Is this a bug, or should I check something ?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:5 (1 by maintainers)
Top Results From Across the Web
CA JCLCheck Workload Automation Message Reference Guide
REQUIRED POSITIONAL SUBPARAMETER name1 OMITTED FROM name2. Reason: You did not supply the positional parameter name1, which is required when you specify.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If someone wants a quick fix, replace your current installations with these versions!
graphene==1.4
graphene-django==1.3
graphql-core==1.1
graphql-relay==0.4.5
This worked for me.
I have a strange scenario running into the exact same error message.
This is a project I haven’t touched in a while. I fixed a bug and while I was at it, I updated django to 1.11.6. I did not touch the versions of graphene (1.4) and of graphene-django (1.3).
After running
docker-compose build
to install the new django version, almost all of my tests fail. I get bothTypeError: resolve() missing 2 required positional arguments: 'context' and 'info'
and
graphql.error.located_error.GraphQLLocatedError: mutate() got an unexpected keyword argument 'input'
.On the server, in the untouched version, all the tests are still passing.
Here’s a
pip freeze
of the server versionHere’s a
pip freeze
of the broken local versionThe major difference I see is the version of graphql-core.
It turns out that I had to manually pin down
graphql-core==1.1
, even though thesetup.py
of graphene 1.4 specifies'graphql-core>=1.1,<2'
.Strange, isn’t it?