第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

復(fù)制文檔的簡(jiǎn)單云功能出錯(cuò)

復(fù)制文檔的簡(jiǎn)單云功能出錯(cuò)

慕田峪4524236 2023-05-18 10:45:39
我正在創(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)試它嗎?
查看完整描述

1 回答

?
肥皂起泡泡

TA貢獻(xiàn)1829條經(jīng)驗(yàn) 獲得超6個(gè)贊

錯(cuò)誤信息:

錯(cuò)誤:參數(shù)“documentPath”的值不是有效的資源路徑。路徑必須是非空字符串。

建議您將一個(gè)空字符串或其他一些無(wú)效值(例如未定義)傳遞給您對(duì)doc(). 我的猜測(cè)是第二個(gè)。

您的通配符路徑中包含“docID”,但您正嘗試使用不同的名稱“postId”訪問(wèn)它。您需要為兩者使用相同的名稱。也許您打算使用這樣的通配符:

exports.onCreateJournal = functions.firestore
  .document("/users/{userId}/journal/{postId}")

請(qǐng)注意,我將“docID”替換為“postId”以匹配您的代碼。


查看完整回答
反對(duì) 回復(fù) 2023-05-18
  • 1 回答
  • 0 關(guān)注
  • 213 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)