Mar*_*laz 5 javascript firebase google-cloud-functions
我正在尝试在 Firebase Cloud Functions 上部署一个简单的函数,但控制台记录了一个错误,我无法弄清楚在哪里
我的 index.js:
const functions = require('firebase-functions');
const admin = require('firebase-admin')
admin.initializeApp()
exports.updateAccount = functions.firestore.document('accounts/{client_id}/movements').onWrite(change => {
const document = change.after.exists ? change.after.data() : null
console.log(document)
})
Run Code Online (Sandbox Code Playgroud)
控制台说:
? functions: failed to create function updateAccount
HTTP Error: 400, The request has errors
Functions deploy had errors with the following functions:
updateAccount
To try redeploying those functions, run:
firebase deploy --only functions:updateAccount
To continue deploying other features (such as database), run:
firebase deploy --except functions
Error: Functions did not deploy properly.
Run Code Online (Sandbox Code Playgroud)
pep*_*epe 10
您的云函数参数始终指向文档级别,而不是集合级别。
exports.updateAccount = functions.firestore
.document('accounts/{client_id}/movements/{movement_id}')
.onWrite(change => {
const document = change.after.exists ? change.after.data() : null
console.log(document)
})
Run Code Online (Sandbox Code Playgroud)
您正在尝试在集合级别而不是文档级别进行部署。
| 归档时间: |
|
| 查看次数: |
2190 次 |
| 最近记录: |