https://prefect.io logo
Title
j

Jennifer Meng

07/16/2020, 8:14 PM
Hello everyone! I try to run a flow with graphql, but failed to pass parameters. Please help! ūüôā
mutation($parameters: JSON!) {create_flow_run(input: { flow_id: "my_flow_id", parameters: $parameters }) {id}}
{"parameters":{"param1":"my_param1"}}

Argument 'input' has invalid value {flow_id: \"my_flow_id\", parameters: $parameters}.
z

Zachary Hughes

07/16/2020, 8:54 PM
Hi @Jennifer Meng! When substituting
my_flow_id
with an actual flow ID, I'm able to successfully run the mutation you posted. Do you mind sharing how you're trying to run this mutation?
j

Jennifer Meng

07/16/2020, 9:50 PM
Thank you!! I use postman graphql post body, without passing parameters, I'd able to run it.
z

Zachary Hughes

07/16/2020, 9:53 PM
Hmm, I'm not super familiar with Postman, but it looks like you might need to define your variable values in a separate section? https://learning.postman.com/docs/sending-requests/supported-api-frameworks/graphql/#working-with-graphql-variables
j

Jennifer Meng

07/16/2020, 10:20 PM
Yes, I put them in separate section. Thank you for looking it up! May I ask how did you run it successfully?
z

Zachary Hughes

07/16/2020, 10:24 PM
I use a tool called Altair, which is fairly similar. Here's what my query looked like (with the flow ID edited out):
mutation($parameters: JSON!) {create_flow_run(input: { flow_id: "my-flow-id", parameters: $parameters }) {id}}
And my variable definition section looks like this:
{
  "parameters": {
    "param1": "my_param1"
  }
}
I think that's identical to what you originally shared, correct?
j

Jennifer Meng

07/17/2020, 3:37 PM
Turn out something might be wrong with my local prefect server, I try a different server and it works. If I removed the parameters it works on my local server, so it never even occurs to my mind, this is weird! Thank you so much for helping!