Mutation flowTriggerReceive: Type error for field 'order_id'

Trying to get my flowTriggerReceivemutation to work but it keeps telling me I have issues with `order_id`.

$flow_mutation = [
    'query' => '
        mutation flowTriggerReceive($handle: String!, $payload: JSON!) {
            flowTriggerReceive(handle: $handle, payload: $payload) {
                userErrors {
                    field
                    message
                }
            }
        }
    ',
    'variables' => [
        'handle' => 'order-tag-updated',
        'payload' => [
            'order_id' => $order_id,
            'tagAdded' => $tag_added,  
        ]
    ]
];

First it tells me:

[{“field”:[“body”],“message”:"Errors validating schema:\n Required field missing: ‘order_id’.\n”}]

Then I add order_id and it tells me I have Type errors:

[{“field”:[“body”],“message”:“Errors validating schema:\n Type error for field ‘order_id’: gid://shopify/Order/6826489905324 is not an Order.\n”}]

I tried just the INT and it still didnt work:

[{“field”:[“body”],“message”:“Errors validating schema:\n Type error for field ‘order_id’: 6826489905324 is not an Order.\n”}]

The order is indeed an actual order.

In my TOML:

[settings]

[[settings.fields]]
type = “order_reference”

Have you inspected the request body going out? The field/body stuff looks odd, so worth confirmed the structure is correct

@Stats_Marketing accepted the response from @paul_n without further comment or explanation, so would be great to have a bit more info.

I have exactly the same issue as the OP. I am working with a dev remix app and store.

Whether calling the Admin GraphQL API from a lambda, Postman or graphiql, I get the error:

Errors validating schema:\n  Type error for field 'order_id': gid://shopify/Order/6905511379059 is not an Order

Like the OP, my shopify-extension.toml file is pretty basic:

[[extensions]]
name = "Shopify Flow Trigger Test"
handle = "flow-trigger-test"
type = "flow_trigger"
uid = "d406c6ac-062f-d369-d13d-ec529571d07fb225a08e"

[settings]

  [[settings.fields]]
  type = "order_reference"

For example, in graphiql, executing:

mutation {
  flowTriggerReceive(
    handle: "flow-trigger-test"
    payload: {order_id: "gid://shopify/Order/6905511379059"}
  ) {
    userErrors {
      field
      message
    }
  }
}

returns:

{
  "data": {
    "flowTriggerReceive": {
      "userErrors": [
        {
          "field": [
            "body"
          ],
          "message": "Errors validating schema:\n  Type error for field 'order_id': gid://shopify/Order/6905511379059 is not an Order.\n"
        }
      ]
    }
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 1,
      "actualQueryCost": 1,
      "throttleStatus": {
        "maximumAvailable": 2000,
        "currentlyAvailable": 1999,
        "restoreRate": 100
      }
    }
  }
}

I am 100% certain the order exists.

I’ve tried all the same things the OP tried.

Any explanation on what the OP did to fix the issue based on the message from @paul_n would be great. I did note the square braces after payload so maybe that’s the change that was necessary(?).

Thanks in advance!

“order_id” not order_id.

Thanks for that.

Also, for anyone who finds this thread later, I just realized that the value of “order_reference” is not the gid, or the order number as a string, it is the order number as an integer. The documentation says this (click “id” next to order_id in Flow trigger reference ) and look for the id field - it’s type is integer, which I missed.

So, in the flowTriggerReceive payload, concerning the order reference, this will not work:

"order_id": "gid://shopify/Order/6905511379059"

Nor will this:

"order_id": "6905511379059"

But this does:

"order_id": 6905511379059

I think we made this more forgiving, so that we accept the GID string an an alternative. Did you see it that call fail? If so, I’ll get our docs updated until we fix that.

Hi Paul - it does not accept the GID string as an alternative in the current version. The only format for “order_id” that did not produce a validation error was using the shopify order id as an integer.