I am using the Graphql api to do a “bulkOperationRunMutation”. But for example, out of 100 products that are sent in the JSONL, some products are not created and it happens randomly. Sometimes, it creates 60 products, sometimes 70 and sometimes 80. It happens randomly for random users.
Have you checked your API response to see if there are any issues or errors with your request?
Hi @haiderdev ![]()
We recommend including userErrors.message in the underlying mutation. The resulting bulk operation url should include error messages for lines where products were not created successfully.
Hope that helps!
I receives this response:
“{“errors”:false,“response”:{“GuzzleHttp\Psr7\Response”:},“status”:200,“body”:{“Gnikyt\BasicShopifyAPI\ResponseAccess”:{“data”:{“bulkOperationRunMutation”:{“bulkOperation”:{“id”:“gid://shopify/BulkOperation/******************”,“url”:null,“status”:“CREATED”},“userErrors”:}},”
and it clearly shows errors as false and status as CREATED
To clarify, userErrors.message would be added to the underlying mutation:
mutation {
bulkOperationRunMutation(
mutation: # add to this underlying mutation section as shown below
"mutation ($input: ProductInput!) { productCreate(input: $input) { ... } userErrors { message field } } }",
stagedUploadPath: ...) {
bulkOperation { ... }
userErrors { # not this section
message
field
}
}
}
Oh my, tis the official Shopify Dev Support ![]()
This is the same thing that I’m doing.
Could you possibly share some of the code you are using to send this request?
$query = <<
And I’ve conformed the JSONL file in staged upload, it contains all 100 products. and there are also no errors there.
Haha first rule of development: always assume every line of code has an error or will throw one… ![]()
I’m on lunch right now, when I get back I will take a look for you.
I mean it looks correct to me.
function createBulkOperation($shopName, $accessToken, $fileKey) {
$url = "https://{$shopName}.myshopify.com/admin/api/2024-01/graphql.json";
$headers = [
"X-Shopify-Access-Token: {$accessToken}",
'Content-Type: application/json'
];
$query = <<
You can try something like this to see if you can get those errors to be thrown but without those errors I am unsure. I haven't worked with bulkOperationRunMutation much.