如何在Firebase功能中将数据保存到Firestore?
const functions = require('firebase-functions');
const admin = require('firebase-admin');
// // Create and Deploy Your First Cloud Functions
// // https://firebase.google.com/docs/functions/write-firebase-functions
//
exports.saveContact = functions.https.onRequest((request, response) => {
admin.firestore().collection("contact").add({
name: request.name;
}).then(function(docRef) {
console.log("Document written with ID: ", docRef.id);
}).catch(function(error) {
console.error("Error adding document: ", error);
});
response.send("Hello from Firebase!");
});
使用此代码我收到此错误
错误:无法处理请求