Skip to content
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

Why include AuthInfoField and not GraphqlError() ? #29

Open
ShivanshJ opened this issue Jun 2, 2021 · 1 comment
Open

Why include AuthInfoField and not GraphqlError() ? #29

ShivanshJ opened this issue Jun 2, 2021 · 1 comment

Comments

@ShivanshJ
Copy link
Collaborator

AuthInfoField makes things complex especially if you use Relay.
A lot of errors of the type : Object doesn't match crop up.

Can the error simply be a graphQLError ?
(from the library graphql.error.base import GraphQLError )

@ShivanshJ
Copy link
Collaborator Author

I try to include relay connection like this.

class PostObject(SQLAlchemyObjectType):
    class Meta:
        model = Post
        interfaces = (graphene.relay.Node, )

class ProtectedPost(graphene.Union):
    class Meta:
        types = (PostObject, AuthInfoField)

class PostConnection(graphene.Connection):
    class Meta:
        node = ProtectedPost
        
class Query(graphene.ObjectType):
    node = graphene.relay.Node.Field()
    my_posts = graphene.ConnectionField(PostConnection)
    

However, I get an error when the "token" expires. error is -

Resolved value from the connection field have to be iterable or instance of PostConnection. Received "<flask_graphql_auth.fields.AuthInfoField object at 0x10c34e160>"

This is because AuthInfoField returns an Object Literal whereas IterableConnection expects an Iterable list.
Throwing an Exception or GraphQL error should solve so many complications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant