0
votes

I tried to copy exactly the same style as the guy in this video does:

https://youtu.be/7IkUgCLr5oA?t=259

enter image description here

Here's my version (mine is JS, his is TS):

exports.upload = functions.https.onRequest((req,res) => {
    cors(req, res, () => {});
        const pr = new Promise((resolve,reject)=> {
            form = formidable()
            form.parse(req, (err,fields,files) => {
                resolve(files.toString())
            });
        });
        pr.then(data=>res.send(data));
    });
});

My code just lags until the response times out. Any ideas why? I've tried all sorts of other ways, without using the Promise, but nothing works.

1
BTW, changing it to resolve('asdasd'), doesn't help.geokavel
Please don't post screenshots of your code, or other textual content. Instead post the actual text, and use the formatting tools of Stack Overflow to mark it up.Frank van Puffelen
Screenshot is from the video.geokavel
Hi, I am not sure how the video related with your code. What are you trying to achieve?llompalles
What happens if you catch errors: pr.then(data=>res.send(data)).catch(error => {console.log(error); });. You should see the output in the Firebase console.Renaud Tarnec

1 Answers

0
votes

Turns out I needed to use formidable-serverless: https://www.npmjs.com/package/formidable-serverless