Shopify bulk product create operation returning "The JSONL file could not be found".

Shopify bulk product create operation returning "The JSONL file could not be found".

RaviGohil2211
Shopify Partner
8 0 0

Hello Guys,

I am trying to work on bulk product creation operation, but receiving in a response from Shopify

"The JSONL file could not be found. Try uploading the file again, and check that you've entered the URL correctly for the stagedUploadPath mutation argument."

 

I have created a JSONL file with following , 
 

 

{ "input": { "title": "Sweet new snowboard 1"} }

 

 

Then create stage file URL by mutation "stagedUploadsCreate" and getting making following call check the code 

 

 const apiUrl = https://shopify-staged-uploads.storage.googleapis.com/;
            const filePath = './downloads/mytest.myshopify.com/test-bulkimport.jsonl';
            const formData = new FormData();
            result.data.stagedUploadsCreate.stagedTargets[0].parameters.forEach(param => {
                // console.log(param,'ook')
                formData.append(param.name, param.value);
            });
            formData.append('file', fs.createReadStream(filePath));

            console.log(formData,'opop')
            const uploadedJsonUrl = fetch(, {
            method: 'POST',
            body: formData,
        })
            .then(response => {
                if (!response.ok) {
                    throw new Error(`HTTP error! Status: ${response.status}`);
                }
                return response.text(); // Return the entire response as text
            })
            
            .catch(error => {
                return {error:"error in file upload from shopify"}
                // console.error(error);
            });

 

 

Here I am using node js,
1. "filePath" = path of my file under my app directory 

2. result.data.stagedUploadsCreate.stagedTargets[0].parameters = creating or appending the dynamic parameters from the response of stagedURL

3.  fs.createReadStream(filePath) = appending the file to the form data,

I am getting the response after upload call "https://storage.googleapis.com/shopify-staged-uploads/tmp/84685652249/bulk/4c1a708c-3bf6-4a4a-98ad-5...

But even it returns the error after running the bulk operation for the products created. 

 

Replies 0 (0)