Firebase cloud function always timeout

后端 未结 2 1206
太阳男子
太阳男子 2020-12-29 09:21

I\'m exploring the firebase cloud functions and I\'m trying to send a notifications with an http request.

The problem is that even if I manage to send the notificati

2条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-29 09:57

    HTTP-triggered Cloud Functions work just like Express apps -- you have a response object (res) that you need to use to send something when the request is done. In this case, it looks like you could do something like:

    return Promise.all([
      /* ... */
    ]).then(() => {
      res.status(200).send('ok');
    }).catch(err => {
      console.log(err.stack);
      res.status(500).send('error');
    });
    

提交回复
热议问题