I am using saleor backend for my current project. There I have to execute saleor graphql queries and mutations inside the code. So instead of hitting graphql api using url I am using schema.execute() with query and variables. With this approach the custom queries and mutations that I created are working perfectly fine. But when I am executing saleor's mutation or queries like-
import graphene
schema = graphene.Schema(ProductQueries)
query = """
{
products(first: 2, channel: "default-channel") {
edges {
node {
id
name
defaultVariant{
id
}
}
}
}
}
"""
data = schema.execute(query, context_value={"app":"app"})
print(data.data)
output - {'products': None}
And when I am checking for errors using print(data.errors), It is giving me this error-
**[GraphQLLocatedError("'NoneType' object has no attribute 'app'")]**
i checked out in types and schemas of these mutations and queries and nowhere this 'app' attribute is mentioned. Just to test I tried to pass this 'app' attribute in context_value with empty string as well but still It didn't work and this time the error was-
**[GraphQLLocatedError("'dict' object has no attribute 'app'")]**