Closed sarangi12 closed 2 years ago
This is a server error and not a bug in the library. Try and validate your mutation in other clients, or reach out for help on our discord channel.
Can you guide how to validate mutation?? As I Check the query, It's working, just not getting response in flutter only.
Can you guide how to validate mutation??
Try and perform your mutation in a different client (e.g. postman) and see if this is only happening in this client.
As I Check the query, It's working,
How are you "checking" your query? How do you verify that this is working?
just not getting response in flutter only.
It is working though. You're getting an error from the server because your mutation is invalid.
I have checked query in Postman Its working fine getting response in Postman also
Do you have a screenshot of this?
Check this screenshots, It's not passing the value which cases error. Do you have any suggestion how to pass it?
Result in postman:
Error in flutter:
Cool. First off, I can't verify that these two requests are the same because you've decided to crop the message.
Secondly, the second screenshot is now a different error (which is caused by you not escaping your quotes properly).
Yes, I got it. As i'm new to graphql, i don;t have much idea about this. Can you guide me how can i get rid of this error. I have trying to resolve this since last few days. Can you help me, How can i pass this query.
final graphql.MutationOptions options =
graphql.MutationOptions(document: graphql.gql("""
mutation {
createPost(
spaceId: "spaceid",
input: {
postTypeId: "id"
mappingFields: [
{
key: "title"
type: text
value: "\"Hi, eveyone\""
},
{
key: "content"
type: html
value: "\"<p>Good Afternoon</p>\""
}
]
publish: true
}
) {
id
}
}
"""));
var result = await fluttergql.GraphQLClient(
cache: fluttergql.GraphQLCache(),
link: _link,
).mutate(options);
I'm trying to help you. If you'd please share the screenshot of executing exactly the same mutation in postman.
In this query , in mappingFields and in value , I need send json string, which I am unable to send.
Here is a screenshot of exact same query from postman,
Here, what I am trying to send in flutter
Your mutation itself is a string and you're not escaping your double quotes properly. This is not a graphql problem but a problem with how you're using dart.
You have different ways of escaping your \
, the easiest probably is to prefix your mutation with r
. This'll treat the string as a raw string which will not read your backslash as trying to escape your quote.
For example, take the program
print("hello"); // prints hello
print("\"hello\""); // prints "hello"
print("\\\"hello\\\""); // prints \"hello\"
print(r"\"hello\""); // prints \"hello\"
I tried putting 'r' It's giving me this error:
QueryResult(source: QueryResultSource.network, data: null, context: Context({}), exception: OperationException(linkException: ServerException(originalException: null, parsedResponse: Response(data: null, errors: [GraphQLError(message: Syntax Error: Expected ":", found Name "everyone"., locations: null, path: null, extensions: null)], context: Context({ResponseExtensions: Instance of 'ResponseExtensions'}), response {errors: [{message: Syntax Error: Expected ":", found Name "everyone"., code: 10, timestamp: 2022-08-30T12:45:49.283Z}]})), graphqlErrors: []), timestamp: 2022-08-30 18:15:49.284640)
So this is, again, a server error. I don't know why it won't accept your data as I don't know what api you're developing against. But it is not an error in this framework.
I can see that you've changed the mutation from when you called with postman, so have you tried:
I tried all possible solutions, but didn't get success.
But thanks for your help.
If you need more help, feel free to reach out on our discord.
I am trying to call Mutation method with MutationOptions. Method and query are as follow. Method:
Response:
Data is null while GraphQl showing error "Validation Params Failed" while Query is working i confirmed with other app.
Please guide me through this.