Int cannot parse the given literal of type

271 views
Skip to first unread message

Kubilay Kocabal

unread,
Jul 21, 2023, 7:35:29 AM7/21/23
to KrakenD Community
Hi everybody, I am having trouble sending url parameter to graphql. 
Basicly I want to do take my serviceNo from my url and send it to graphql in query
My code is :
{
"endpoint": "/gw/graphql/{serviceNo}",
"input_query_strings": ["*"],
"method": "GET",
"output_encoding": "json",
"backend": [
{
"host": [
"<my_host>"
],
"url_pattern": "/my_url",
"encoding": "json",
"method": "GET",
"extra_config": {
"backend/graphql": {
"type": "query",
"query": "query Service($sNo: Int) {\n service(\n where: {mainServiceNo: {eq: $sNo}}\n ) {\n items {\n serialNo\n }\n }\n}",
"variables": {
"sNo": "{
serviceNo}"
}
},
"backend/http": {
"return_error_details": "backend_alias"
}
}
}
]
}


and I am getting this response from server:
{
    "error_backend_alias": {
        "http_status_code"500,
        "http_body":"{\"errors\":[{\"message\":\"Int cannot parse the given literal of type \`StringValueNode\`.\",\"path\":[\"sNo\"]}]}"
    }
}

I have to send this parameter int , but in variables area it converts string I think,
I could not figure this out.

Can anybody help me please ?

Thank you.

Regards,
Reply all
Reply to author
Forward
0 new messages