BulOperationRunMutation error

Hello,

I got an error trying to execute bulkOperationRunMutation to create many fulfillments in one request.
Here is what I did so you have a bit of context:

  1. stagedUploadCreate with these input:
"input":
		[
			{
				"filename":"bulk_fulfillment_create_variables",
				"httpMethod":"POST",
				"resource":"BULK_MUTATION_VARIABLES",
				"mimeType":"text/jsonl"
			}
		]

This worked.

  1. Upload my jsonl file using the https://shopify-staged-uploads.storage.googleapis.com url and using the parameters from the response of the stagedUploadsCreate to send via multiparts/form-data

This worked as well and I can see the file I upload by visting the url returned by this request

Here is an example of file i’ve uploaded:

{"lineItemsByFulfillmentOrder":[{"fulfillmentOrderId":"gid://shopify/FulfillmentOrder/MY_FULFILLMENT_ORDER_ID_1"}],"trackingInfo":{"numbers":["MY_TRACKING_NUMBER_1"],"urls":["https://my.tracking.url/1"]},"notifyCustomer":true}
{"lineItemsByFulfillmentOrder":[{"fulfillmentOrderId":"gid://shopify/FulfillmentOrder/MY_FULFILLMENT_ORDER_ID_2"},{"fulfillmentOrderId":"MY_FULFILLMENT_ORDER_ID_2_1"}],"trackingInfo":{"numbers":["MY_TRACKING_NUMBER_2"],"urls":["https://my.tracking.url/2"]},"notifyCustomer":true}
{"lineItemsByFulfillmentOrder":[{"fulfillmentOrderId":"gid://shopify/FulfillmentOrder/MY_FULFILLMENT_ORDER_ID_3"}],"trackingInfo":{"numbers":["MY_TRACKING_NUMBER_3"],"urls":["https://my.tracking.url/3"]},"notifyCustomer":true}
  1. Execute BulkOperationRunMutation

This is the part where I have the error. Here is my graphql mutation:

mutation BulkOperationRunMutation {
    bulkOperationRunMutation(
        mutation: "mutation call($fulfillment: FulfillmentInput!) { fulfillmentCreate(fulfillment: $fulfillment) { fulfillment { id status } userErrors { message field } } }"
        stagedUploadPath: "tmp/59879194782/bulk/74281d32-f408-46d0-8a1a-e9c0dff4d580/bulk_fulfillment_create_variables"
        groupObjects: false
    ) {
        bulkOperation {
            createdAt
            status
        }
        userErrors {
            code
            field
            message
        }
    }
}

Here is the error I get when sending the mutation:

"data":
	{
		"bulkOperationRunMutation":
		{
			"bulkOperation":null,
			"userErrors":
			[
				{
					"message":"Invalid Bulk Mutation Field - Variable $input of type FulfillmentInput! was provided invalid value",
					"field":null
				}
			]
		}
	}

Can someone help me on this ?
Thanks in advance !

Hi @avoiturier

The “Internal error” with bulkOperationRunMutation usually means the mutation string you’re passing is formatted incorrectly or missing the variable definition.

Make sure your JSONL file contains only the input values for each mutation call, one JSON object per line:

{"input": {"id": "gid://shopify/Product/123", "title": "New Title 1"}}
{"input": {"id": "gid://shopify/Product/456", "title": "New Title 2"}}

Then, ensure the mutation string you pass to bulkOperationRunMutation defines the operation and its input variable, like this example for updating products:

"mutation productUpdate($input: ProductInput!) { productUpdate(input: $input) { product { id } userErrors { field message } } }"

The bulkOperationRunMutation call will then correctly take the $input values line by line from your uploaded JSONL file.

Hope this helps!

Hello

Thanks for your answer !

It solved the initial issue but there is a new issue now:

"userErrors":
			[
				{
					"message":"You must use an allowed mutation name.",
					"field":
					[
						"mutation"
					]
				}
			]

It seems like the mutation I want (fulfillmentCreate) is not supported by the bulkOperationRunMutation…