Ric*_*ard 1 google-cloud-platform firebase-tools google-cloud-functions google-cloud-firestore firebase-cli
我已成功运行 Firebase 模拟器:
E:\firebase>firebase emulators:start
i emulators: Starting emulators: functions, firestore
! Your requested "node" version "8" doesn't match your global version "10"
+ functions: Emulator started at http://localhost:5001
! No Firestore rules file specified in firebase.json, using default rules.
i firestore: Serving ALL traffic (including WebChannel) on http://localhost:808
0
! 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 functions: Watching "E:\firebase\func
tions" for Cloud Functions...
! functions: Your GOOGLE_APPLICATION_CREDENTIALS environment variable points to
E:\firebase\key.json. Non-emulated serv
ices will access production using these credentials. Be careful!
+ functions[notifyNewMessage]: firestore function initialized.
+ All emulators started, it is now safe to connect.
Run Code Online (Sandbox Code Playgroud)
functions具有功能的文件如下notifyNewMessage:
const functions = require('firebase-functions')
const admin = require('firebase-admin')
admin.initializeApp()
exports.notifyNewMessage = functions.firestore
.document('test/{test}')
.onCreate((docSnapshot, context) => {
console.log(docSnapshot.data())
}
Run Code Online (Sandbox Code Playgroud)
当我在 Firebase 控制台中手动创建新文档时,Windows 中的 CLI 不会记录任何内容。我该如何解决这个问题,以便它记录 CLI 中函数的内容?
| 归档时间: |
|
| 查看次数: |
4232 次 |
| 最近记录: |