System Information
- Strapi Version: v4.6.0
- Operating System: windows
- Database: mysql
- Node Version: v18.13.0
- NPM Version: 9.4.1
- Yarn Version: not using
I have a csv file with product data (name, imgURL), i tried import then in strapi admin panel using strapi-plugin-import-export-entries but webp images are not uplaoding then I tried uploading a single webp image it succeded. whereas name field are importing as normal and entries with image/png, image/jpg are uploading into entries normally.
while trying to importing data via bootstrap({ strapi })
in src/index.js here is my code -
bootstrap({ strapi }) {
async function createEntry(){
const { Readable } = require('stream');
const fetch = require('node-fetch');
const response = await fetch('https://www.unboxindustry.com/wp-content/uploads/2022/05/28429-productpicture-hires-en-ls6-b602s_03.png');
const buffer = await response.buffer();
const stream = new Readable();
stream.push(buffer);
stream.push(null);
// Upload the file first
const uploadedImage = await strapi.plugins.upload.services.upload.upload({
data: stream,
headers: {
'Content-Type': 'image/webp',
},
});
const entry = await strapi.entityService.create('api::product.product',{
data :{
product_id: 9044,
product_price: 10,
product_description: 'dsd',
product_name: 'Product Demo 1',
product_display :{
id: uploadedImage[0].id,
}
},
populate:'*',
});
console.log('entry');
return entry;
}
const entry = createEntry().then((result)=>{
console.log('result')
}).catch((err)=>{
console.log(err);
});
},
}
this giving error TypeError: Cannot set properties of undefined (setting ‘tmpWorkingDirectory’)
Reason may be: - strapi.plugins.upload.services.upload.upload({ data: stream, headers: { 'Content-Type': 'image/webp', }, });