j

    Jennifer Meng

    2 years ago
    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}.
    Zachary Hughes

    Zachary Hughes

    2 years ago
    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

    2 years ago
    Thank you!! I use postman graphql post body, without passing parameters, I'd able to run it.
    Zachary Hughes

    Zachary Hughes

    2 years ago
    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

    2 years ago
    Yes, I put them in separate section. Thank you for looking it up! May I ask how did you run it successfully?
    Zachary Hughes

    Zachary Hughes

    2 years ago
    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

    2 years ago
    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!