For discussing the development and usage of Checkout UI extensions, post-purchase extensions, web pixels, Customer Accounts UI extensions, and POS UI extensions
Hello Team,
We have an issues regarding graphQL bulk oeration (bulkOperationRunMutation).
We have tried this operation but it always shows Invalid input error.
"code" => "BULK_MUTATION_USER_ERROR_CODE" "field" => null "message" => "Unexpected error - https://cdn.shopify.com/s/files/1/0564/2770/8615/files/stageUploadPath.json?v=1628588225 not valid for shop 56427708615, bucket bulk/"
can you ellaborate about "stagedUploadPath" this variable we are not clear what input/data this variable accepts !
Hey @keyur_choksi
To get the stagedUploadPath(docs), you have to first run the stagedUploadsCreate Mutation, which will return it. The stagedUploadPath is a temporary URL which acts as a place to hold the file that stores your variables for the Bulk Operation Run Mutation.
There's a step thorough the steps required to run a Bulk Operation Run Mutation here. Hope that helps!
Hello @Luke_K
Thanks for your reply that was helpfull.
But now we have another issue arise called "message" => "Unexpected file structure - expected JSONL"
We have gone through your provided doc link and we have processed all steps.
But in last step when we are calling the bulkOperationRunMutation it is ginving us the below error and we cannot figure out where it goes wrong and the jsonl file we have created is exacly same as in the documentation.
"message" => "Unexpected file structure - expected JSONL"
Hey @keyur_choksi
Could you share the input variables you're including in the bulkOperationRunMutation? Typically we see this error when the input variables that are supplied don't match the GraphQL Admin API Schema (docs).
Also, if you have a x-request_id that would be great too - (this ID is returned in the client side response headers when you call the mutation). Thanks!
Hello @Luke_K
Thanks for your reply.
We have taken below input variables in JSONL file same as in the doc and we are using this for the bulk product create
{ "input": { "title": "Sweet new snowboard 1", "productType": "Snowboard", "vendor": "JadedPixel" } }
{ "input": { "title": "Sweet new snowboard 2", "productType": "Snowboard", "vendor": "JadedPixel" } }
{ "input": { "title": "Sweet new snowboard 3", "productType": "Snowboard", "vendor": "JadedPixel" } }
{ "input": { "title": "Sweet new snowboard 4", "productType": "Snowboard", "vendor": "JadedPixel" } }
{ "input": { "title": "Sweet new snowboard 5", "productType": "Snowboard", "vendor": "JadedPixel" } }
{ "input": { "title": "Sweet new snowboard 6", "productType": "Snowboard", "vendor": "JadedPixel" } }
{ "input": { "title": "Sweet new snowboard 7", "productType": "Snowboard", "vendor": "JadedPixel" } }
{ "input": { "title": "Sweet new snowboard 8", "productType": "Snowboard", "vendor": "JadedPixel" } }
{ "input": { "title": "Sweet new snowboard 9", "productType": "Snowboard", "vendor": "JadedPixel" } }
{ "input": { "title": "Sweet new snowboard 10", "productType": "Snowboard", "vendor": "JadedPixel" } }
Below is the x-request-ID which we got in response header.
"X-Request-ID" => array:1 [▼ 0 => "0ae5335b-2c18-4228-807b-7b6c335e2fcb" ]
Hey @keyur_choksi
So, following our documentation, I'm able to successfully run the Bulk Operations Run Mutation and the example products are imported to my store. One thing I noticed in the logs, is that the filename in your stagedUploadPath "stege_file" doesn't have a .jsonl extension on the end. Likely could be the cause of issue here. I don't see the .jsonl in the docs, so will note that for action.
Here's what I did -
1. Created a jsonl file with the same products from the docs, and then I called stagedUploadsCreate with the following inputs :
{
"input": [
{
"resource": "BULK_MUTATION_VARIABLES",
"filename": "test.jsonl",
"mimeType": "text/jsonl",
"httpMethod": "POST"
}
]
}
2. Perform my Curl POST as documented here to upload the JSONL file.
3. Call my Bulk Operation Run Mutation ensuring that my stageduploadPath has .jsonl on the end e.g "tmp/xxxxxxxx/bulk/xxxxxxxxxx/test.jsonl".
Following that, the mutation is created, then completes, and products are shown in my store -
Wondering if you wouldn't mind trying that? Let me know how that goes - thanks!
Hello @Luke_K
Thanks for your reply..
We have already processed with .josnl but it was not working so we tried without .jsonl as per the doc.
Though we have tried again with .jsonl and it still gives us the below error
"userErrors" => array:1 [▼
0 => array:2 [▼
"message" => "Unexpected file structure - expected JSONL"
"field" => null
]
]
We have passed this : tmp/xxxxxxxxxx/bulk/xxxxxxxxxxxxxxx/stage.jsonl
Please see the below request id
"X-Request-ID" => array:1 [▼ 0 => "6350d30e-e245-464d-9318-7e48beedc30e" ]
Hey @keyur_choksi
That's strange, curiously I'm not able to replicate this at all when following the tutorial and using that jsonl product example from the docs.
I'd noted you were using the Guzzle client in the logs, and I'm not - that is a difference here. Potentially this could be something client specific that's causing this. Does the jsonl file upload correctly when you upload the multi part form? Perhaps just posting the multipart forum via the terminal could be an option and I'd triple check that the jsonl file is saved as valid jsonl format (that's got me in the past).
Hello @Luke_K
We have proceeded the bulk operation via PHP curl and tried to bulk create the product but the shopify also gives us the same error please see below response :
{
"data": {
"bulkOperationRunMutation": {
"bulkOperation": null,
"userErrors": [{
"code": "BULK_MUTATION_USER_ERROR_CODE",
"field": null,
"message": "Unexpected file structure - expected JSONL"
}]
}
},
"extensions": {
"cost": {
"requestedQueryCost": 10,
"actualQueryCost": 10,
"throttleStatus": {
"maximumAvailable": 1000.0,
"currentlyAvailable": 990,
"restoreRate": 50.0
}
}
}
}
Also you can see below the response of upload jsonl file.
<?xml version="1.0" encoding="UTF-8"?>
<PostResponse>
<Location>
https://shopify.s3.amazonaws.com/tmp%2F56427708615%2Fbulk%2F0df27f4e-2892-40b0-ac3d-ea1d76d684ff%2Fstage.jsonl
</Location>
<Bucket>
shopify
</Bucket>
<Key>
tmp/56427708615/bulk/0df27f4e-2892-40b0-ac3d-ea1d76d684ff/stage.jsonl
</Key>
<ETag>
"a7691a316d4b3f6f5424fbad293504d0"
</ETag>
</PostResponse>
Hey @keyur_choksi
Perhaps saving the attached .txt file as a valid .jsonl file could work (our forums won't let me attach jsonl unfortunately).
It's the same file from the tutorial - following along with the tutorial I'm able to get this working.
Hello @Luke_K
We have also tried your .txt file via converting it to .jsonl.
Though it is givin us the same Unexpected file structure - expected JSONL Please see below.
{
"data": {
"bulkOperationRunMutation": {
"bulkOperation": null,
"userErrors": [{
"code": "BULK_MUTATION_USER_ERROR_CODE",
"field": null,
"message": "Unexpected file structure - expected JSONL"
}]
}
},
"extensions": {
"cost": {
"requestedQueryCost": 10,
"actualQueryCost": 10,
"throttleStatus": {
"maximumAvailable": 1000.0,
"currentlyAvailable": 990,
"restoreRate": 50.0
}
}
}
}
Hello @Luke_K
Can you please get back for the last reply see below.
We have also tried your .txt file via converting it to .jsonl.
Though it is givin us the same Unexpected file structure - expected JSONL Please see below.
{
"data": {
"bulkOperationRunMutation": {
"bulkOperation": null,
"userErrors": [{
"code": "BULK_MUTATION_USER_ERROR_CODE",
"field": null,
"message": "Unexpected file structure - expected JSONL"
}]
}
},
"extensions": {
"cost": {
"requestedQueryCost": 10,
"actualQueryCost": 10,
"throttleStatus": {
"maximumAvailable": 1000.0,
"currentlyAvailable": 990,
"restoreRate": 50.0
}
}
}
}
Hello @Luke_K
We have provided you the errors on almost 1-2 weeks ago and we have tried almost all your solutions though it is not succeeded.
Can you please get back ASAP for the last reply as we have urgent requirenments see below.
We have also tried your .txt file via converting it to .jsonl.
Though it is givin us the same Unexpected file structure - expected JSONL Please see below.
{
"data": {
"bulkOperationRunMutation": {
"bulkOperation": null,
"userErrors": [{
"code": "BULK_MUTATION_USER_ERROR_CODE",
"field": null,
"message": "Unexpected file structure - expected JSONL"
}]
}
},
"extensions": {
"cost": {
"requestedQueryCost": 10,
"actualQueryCost": 10,
"throttleStatus": {
"maximumAvailable": 1000.0,
"currentlyAvailable": 990,
"restoreRate": 50.0
}
}
}
}
Hey @keyur_choksi
Apologies for the delayed reply. To be clear, this is a client side issue. The error you are receiving is a client side error - this isn’t an error that can be investigated from Shopify’s side. In our logs - the client is passing invalid jsonl. Invalid jsonl passed by the client would be exactly that - Invalid jsonl.
We have followed the tutorial step by step here, and we cannot replicate this unfortunately. The format of the jsonl file must match the GraphQL schema exactly. What you are passing when creating your Bulk Operation(documentation) is not valid jsonl.
Hello @Luke_K ,
Thanks for your reply.
What do you mean by client side as we have tried same as from documentation.
So
first we have tried all steps as per the documentation.
second we have generated same jsonl fine as per the documentation and it was not working.
third we passed same jsonl as you have provided us that is also throwing the same invalid jsonl error.
and last you have told us that it may be due to a guzzle HTTP so we have tried via core PHP and curl though it is giving us the same error.
So how can we identify that which jsonl is valid as we have tried all jsonl which shopify provided.
Please let us know as it is quite urgent
Hello @Luke_K ,
Good Morning,
Hope you are doing well !!
We have read your last email and follow this link : https://help.shopify.com/en/questions/partners#/contact and select the new option Report an issue [BETA] to get the solution of our issue regarding "Unexpected file structure - expected JSONL".
We send email two times in this option but still we didn't get any solution in our issue, we are stuck here and waiting for the help.
Did this ever get resolved?