-
-
Notifications
You must be signed in to change notification settings - Fork 263
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
Strawberry-graphql has a problem with IntrospectionQuery #685
Labels
bug
Something isn't working
Comments
Hey @mstrumeck 👋 Thank you for choosing Robyn 😄 Can you please share your |
@sansyrox here's a minimal reproduction: import robyn
import strawberry
app = robyn.Robyn(__file__)
@strawberry.type
class Query:
hello: str = strawberry.field(resolver=lambda: "Hello, world!")
schema = strawberry.Schema(query=Query)
@app.post("/graphql")
async def handle_api_request(request: robyn.Request) -> robyn.jsonify:
import json
# note this
body = json.loads(request.body)
query = str(body["query"])
variables = body.get("variables")
data = await schema.execute(
query,
variables,
)
return robyn.jsonify(
{
"data": (data.data),
**({"errors": data.errors} if data.errors else {}),
**({"extensions": data.extensions} if data.extensions else {}),
}
)
@app.get("/graphql", const=True)
async def handle_api_playground_request(request: robyn.Request):
from strawberry.http.ides import get_graphql_ide_html
return {"description": get_graphql_ide_html(graphql_ide="apollo-sandbox"), "headers": {"Content-Type": "text/html"}}
app.start(port=8080, host="0.0.0.0") # host is optional, defaults to 127.0.0.1 btw using json.loads works, not sure why request.json() doesn't work properly |
Thanks @patrick91 , but it is still not working for me ![]() |
@sansyrox can you show me your cli? |
@patrick91 , here you go ![]() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug Description
Hi! I've decided to use Robyn together with strawberry-graphql but is seems it not working properly. Robyn has a problem with rendering the answer from the standard introspection query. With the following code:
I going to always get the following response:
That's happening always when I trying call http://localhost:8080/graphql with GET
Steps to Reproduce
python=3.12.0, robyn=^0.44.2, uvloop=^0.19.0, strawberry-graphql=^0.212.0
python src.py --dev
http://localhost:8080/graphql
in you browserYour operating system
Linux
Your Python version (
python --version
)3.12
Your Robyn version
latest
Additional Info
No response
The text was updated successfully, but these errors were encountered: