我正在为Vue应用程序使用Firebase托管/ Firestore /功能。托管+ Firestore运行正常。 现在,我想添加更多功能,并想添加功能。为了在本地进行测试,我启动了一个Firestore,并且可以运行所有3个模拟器。 现在,当我启动仿真器并转到托管仿真器时,我可以插入一条记录,该记录也会显示在生产数据库中,但不会触发该功能。它是onCreate。 我部署了该功能,并且工作正常。我可以看到console.log()。
为什么本地/生产写入不触发云功能?
功能如下:
export const sendWelcomeEmail = functions.firestore.document('/activeJobsTestDB/{jobId}').onCreate((data,context) => {
const inputRecord = data.data();
console.log('here' + inputRecord);
// const mailOptions = {
// from: '"Spammy Corp." <noreply@firebase.com>',// to: inputRecord.email,// };
});
i Starting emulators: ["functions","firestore","hosting"]
⚠ Your requested "node" version "8" doesn't match your global version "12"
✔ functions: Emulator started at http://localhost:5001
i firestore: Serving ALL traffic (including WebChannel) on http://localhost:8080
⚠ firestore: Support for WebChannel on a separate port (8081) is DEPRECATED and will go away soon. Please use port above instead.
i firestore: Emulator logging to firestore-debug.log
✔ firestore: Emulator started at http://localhost:8080
i firestore: For testing set FIRESTORE_EMULATOR_HOST=localhost:8080
i hosting: Serving hosting files from: dist
✔ hosting: Local server: http://localhost:5000
✔ hosting: Emulator started at http://localhost:5000
i functions: Watching "/Volumes/Work/playground/sforce-job/sforce-jobs/functions" for Cloud Functions...
> here
✔ functions[sendWelcomeEmail]: firestore function initialized.
✔ All emulators started,it is now safe to connect.
我转到localhost:5000并可以根据需要使用我的应用程序,但未触发该功能。任何帮助将不胜感激。