Hi everyone I am getting TypeError: fetch failed
while uploading large video files to Gemini with fileManager.uploadFile
, it works well and uploads without the error when uploading small video files with smaller file sizes, but I get the error when uploading files with file size more than 100mb
This is my code
const uploaded_file = await fileManager.uploadFile('./' + file_name, {
mimeType: "video/mp4",
displayName: "Video title",
});
let file = await fileManager.getFile(uploaded_file.file.name);
while (file.state === FileState.PROCESSING) {
process.stdout.write(".")
// Sleep for 10 seconds
await new Promise((resolve) => setTimeout(resolve, 10_000));
// Fetch the file from the API again
file = await fileManager.getFile(uploaded_file.file.name)
}
if (file.state === FileState.FAILED) {
return res.status(500).json({msg: "An unknow error occured while processing file, please try again"})
}
const result = await model.generateContent([
{
fileData: {
mimeType: uploaded_file.file.mimeType,
fileUri: uploaded_file.file.uri
}
},
{
text: `The text goes here`
},
]);
it fails at the upload stage which is the fileManager.getFile
line, the file sizes that it has failed on are 180mb, 170mb and 190mb
Please how can I fix it, thanks in advance