I have a firebase function which tries to write data to firebase storage:
const bucket = admin.storage().bucket(/*removed for this question*/);
var tempJSONObject = {
testing: "why are we testing",
anothertest:"constanttesting"
}
try{
const fileName = `storedjokes/81.json`
const file = bucket.file(fileName);
const writeStream = fs.createWriteStream(file);
writeStream.write(tempJSONObject,(err) => {
if(err){
console.log(err.message);
}else{
console.log("data written");
}
});
}catch(e){
console.log('error',e);
}
I get a error in the firebase logs which says:
error TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be one of type string, Buffer, or URL. Received type object
How do I fix this?