每當(dāng)我使用firebase deploy時(shí),它都會(huì)成功創(chuàng)建數(shù)據(jù),但是每當(dāng)我使用firebase serve時(shí),它就會(huì)去捕獲函數(shù)!我正在使用的功能是:exports.createUser = functions.https.onRequest((req, res) => { const newUser = { body: req.body.body, userName: req.body.userName, createdAt: admin.firestore.Timestamp.fromDate(new Date()) }; admin .firestore().collection('screems').add(newUser) .then(doc => { return res.json({ message: `document ${doc.id} created successfully` }); }) .catch(err => { res.status(500).json({ error: 'something went wrong' }); console.error(err); });});我使用郵遞員檢查 API,但它總是說“出了點(diǎn)問題”;
為什么 firebase serve 不工作但 firebase deploy 工作正常?
SMILET
2022-10-27 14:23:13