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.

`def resolve_xxx()` causing `missing 2 required positional`

See original GitHub issue

Hello ! 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:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
OliverEdholmcommented, Jun 6, 2018

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.

2reactions
creimerscommented, Oct 31, 2017

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 both

TypeError: 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 version

Here’s a pip freeze of the broken local version

The 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 the setup.py of graphene 1.4 specifies 'graphql-core>=1.1,<2'.

Strange, isn’t it?

Read more comments on GitHub >

github_iconTop 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 >

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