I'm trying to post some csv files to Firebase by uploading them to Firestore, downloading the urls, and then doing so, but I keep receiving this issue. Ninety percent of the time, it works, but occasionally it displays this error.
Error: [storage/unknown] An unknown error has occurred.
const uploadToStorage = async (file, index) => {
await storage()
.ref(`SensorData/${userName}/session_${sessionCount}/${index}.csv`)
.putFile(file);
const url = await storage()
.ref(`SensorData/${userName}/session_${sessionCount}/${index}.csv`)
.getDownloadURL();
urls[index] = url;
return urls;
};
const uploadToFirebase = async (files) => {
urls = [];
Promise.all(
// Array of "Promises"
files.map((file, index) => uploadToStorage(file, index))
)
.then((url) => {
postReportsToFirebase(urls);
})
.catch((error) => {
console.log(error);
});
};
Version: