Skip to content

busboy never finishes process #1900

@jousi592

Description

@jousi592

I am trying to upload some images to my cloud storage.
I am using form data to send the data down to the cloud function. The data arrives correctly, but the Busboy process never finishes processing it and the function timeouts after 60s.

Here is the implementation:

const firebase = require("firebase"); const Busboy = require("busboy"); require("firebase/storage"); const firebase_db = firebase_admin.database(); const firebase_storage = firebase.storage(); module.exports = (req, res) => { const busboy = new Busboy({headers: req.headers}); const fields = {}; const files = {}; busboy.on('field', (fieldname, val) => { fields[fieldname] = val; }); busboy.on('file', (fieldname, file, filename) => { files[fieldname] = file; }); busboy.on('finish', async () => { // ----> Function never fires try { let project_id = await firebase_db.ref("/project_config/project_id").once("value") project_id = project_id.val() if (!project_id) return res.send({ message: "Project ID not found" }) const new_image_storage_ref = firebase_storage.ref().child(`${project_id}/${fields.route}`) const snapshot = await new_image_storage_ref.put(files.image) const download_url = await snapshot.ref.getDownloadURL() res.send(download_url) } catch (error) { console.log("----- Error during saving content data ", error) res.send({ message: "Error during saving your image, please re-load page and try again or contact support." }) } }); } 

Do you have any idea what might be causing it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions