함수에서 firebase 데이터베이스를 가져 오려고하지만 오류의 원인을 파악할 수 없습니다. 여기 내 코드
exports.test = functions.https.onCall(async (data, context) => {
console.log(data)
const sessionID = data.sessionID
const snapshot = await admin.database().ref('/test/'+sessionID).once('value');
console.log(snapshot);
return snapshot
})
이것이 내가 클라이언트 측 자바 스크립트에서 호출하는 방법입니다.
function callServer(){
var signInCartIn = firebase.functions().httpsCallable('signInCartIn');
var cartInfo = {
"sessionID":"23234",
"log":"6425",
"cuso_id":"cus_IP83EOJ9843s",
"pjo_id":"tm_1HoKt34xY1b"
}
signInCartIn(paymentInfo).then(function(result) {
// Read result of the Cloud Function.
}).catch(function(error) {
// Getting the Error details.
var code = error.code;
var message = error.message;
var details = error.details;
console.log(message)
// ...
})
}
함수를 호출 할 때이 오류가 계속 발생합니다.
처리되지 않은 오류 오류 : Query.once 실패 : 첫 번째 인수는 유효한 이벤트 유형 = "value", "child_added", "child_removed", "child_changed"또는 "child_moved"여야합니다.
오류의 원인은 무엇이며 어떻게 해결할 수 있습니까?
value
실제로 보이는 것은 아닙니다 value
.
거기에 숨겨진 문자하는 있습니다 \u200c
및이 \u200b
.
불쾌한 복사 붙여 넣기처럼 보입니다. 삭제하고 직접 입력하십시오.
const yourValue = 'value';
const realValue = 'value';
const yourCharCodes = yourValue.split('').map(c => c.charCodeAt(0)).join(',');
const realCharCodes = realValue.split('').map(c => c.charCodeAt(0)).join(',');
console.log('yourCharCodes:', yourCharCodes);
console.log('realCharCodes:', realCharCodes);
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다