Hello everyone! I try to run a flow with graphql, ...
# prefect-community
j
Hello everyone! I try to run a flow with graphql, but failed to pass parameters. Please help! 🙂
Copy code
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
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
Thank you!! I use postman graphql post body, without passing parameters, I'd able to run it.
z
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
Yes, I put them in separate section. Thank you for looking it up! May I ask how did you run it successfully?
z
I use a tool called Altair, which is fairly similar. Here's what my query looked like (with the flow ID edited out):
Copy code
mutation($parameters: JSON!) {create_flow_run(input: { flow_id: "my-flow-id", parameters: $parameters }) {id}}
And my variable definition section looks like this:
Copy code
{
  "parameters": {
    "param1": "my_param1"
  }
}
I think that's identical to what you originally shared, correct?
j
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!