我正在創(chuàng)建我的第一個(gè)云函數(shù),它在創(chuàng)建后將子集合中的文檔簡(jiǎn)單地復(fù)制journal到子集合中。activites我希望復(fù)制的文檔具有相同的postId. 功能日志顯示Error: Value for argument "documentPath" is not a valid resource path. Path must be a non-empty string.at Object.validateResourcePath (/workspace/node_modules/@google-cloud/firestore/build/src/path.js:406:15)at CollectionReference.doc (/workspace/node_modules/@google-cloud/firestore/build/src/reference.js:1982:20)at exports.onCreateJournal.functions.firestore.document.onCreate (/workspace/index.js:21:8)at cloudFunction (/workspace/node_modules/firebase-functions/lib/cloud-functions.js:134:23)at Promise.resolve.then (/layers/google.nodejs.functions-framework/functions-framework/node_modules/@google-cloud/functions-framework/build/src/invoker.js:198:28)at process._tickCallback (internal/process/next_tick.js:6這是云函數(shù)exports.onCreateJournal = functions.firestore .document("/users/{userId}/journal/{docID}") .onCreate(async (snapshot, context) => { const data = snapshot.data(); const userId = context.params.userId; const postId = context.params.postId; admin .firestore() .collection("users") .doc(userId) .collection("activities") .doc(postId) .set(data); });或者我應(yīng)該用 Firestore 模擬器調(diào)試它嗎?
復(fù)制文檔的簡(jiǎn)單云功能出錯(cuò)
慕田峪4524236
2023-05-18 10:45:39