簡體   English   中英

錯誤:Reference.child 失敗:第一個參數是無效路徑。路徑必須是非空字符串,並且不能包含“.”、“#”、“$”、“[”或“]”

[英]Error: Reference.child failed: First argument was an invalid path.Paths must be non-empty strings and can't contain “.”, “#”, “$”, “[”, or “]”

我正在嘗試使用 firebase 使用 node.js 授權我的 web 應用程序,並且每當我發送注冊請求時,我都會收到以下消息:錯誤:

Reference.child 失敗:第一個參數是無效路徑 =“/users/test@gmail.com”。 路徑必須是非空字符串,並且不能包含“.”、“#”、“$”、“[”或“]”

 var promise = db.ref(`/users/` + req.body.userid).set({
    password: req.body.password
  });
  promise
    .then((data) => {
      //alert('Record added');
      res.status(200).json({
        status: "Success",
        message: "Welcome" + userid
      });
    })
    .catch((err) => {
      console.log(err);
    }); 

錯誤在這里

db.ref(`/users/` + req.body.userid)

您正在嘗試使用. 在參考中,並且參考不能包含特殊字符,如錯誤所述。

嘗試使用email@gmailcom更改req.body.userid或將 id 更改為字母數字以識別用戶。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM