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:
app = robyn.Robyn(__file__)
@app.post("/graphql")
async def handle_api_request(request: robyn.Request) -> robyn.jsonify:
body = request.json()
query = body["query"]
variables = body.get("variables")
context = {}
root_value = body.get("root_value", None)
operation_name = body.get("operation_name", None)
data = await schema.execute(
query,
variables,
context,
root_value,
operation_name,
)
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):
return {
"description": strawberry.utils.graphiql.get_graphiql_html(),
"headers": {
"Content-Type": "text/html"
}
}
I going to always get the following response:
ERROR:strawberry.execution:Syntax Error: Unexpected <EOF>.
GraphQL request:1:1869
1 | "\n query IntrospectionQuery {\n __schema {\n \n queryType
| { name }\n mutationType { name }\n subscriptionType { name }\n
| types {\n ...FullType\n }\n directives {\n
| name\n description\n \n locations\n args(inc
| ludeDeprecated: true) {\n ...InputValue\n }\n }\n
| }\n }\n\n fragment FullType on __Type {\n kind\n name\n d
| escription\n \n fields(includeDeprecated: true) {\n name\n
| description\n args(includeDeprecated: true) {\n ...InputValue
| \n }\n type {\n ...TypeRef\n }\n isDeprecat
| ed\n deprecationReason\n }\n inputFields(includeDeprecated: tru
| e) {\n ...InputValue\n }\n interfaces {\n ...TypeRef\n
| }\n enumValues(includeDeprecated: true) {\n name\n descri
| ption\n isDeprecated\n deprecationReason\n }\n possibleT
| ypes {\n ...TypeRef\n }\n }\n\n fragment InputValue on __Input
| Value {\n name\n description\n type { ...TypeRef }\n default
| Value\n isDeprecated\n deprecationReason\n }\n\n fragment TypeRe
| f on __Type {\n kind\n name\n ofType {\n kind\n nam
| e\n ofType {\n kind\n name\n ofType {\n
| kind\n name\n ofType {\n kind\n
| name\n ofType {\n kind\n name\n
| ofType {\n kind\n name\n
| ofType {\n kind\n name\n
| }\n }\n }\n }\n }\n
| }\n }\n }\n "
| ^
ERROR:robyn.server:Error while executing route function for endpoint `/graphql`:
That's happening always when I trying call http://localhost:8080/graphql with GET
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 browserLinux
python --version
)3.12
latest
No response
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too