我已經(jīng)被這個(gè)錯(cuò)誤困擾了一段時(shí)間,但仍然無(wú)法找出根源。我正在從客戶端(javascript)調(diào)用 firebase 函數(shù),但 firebase 函數(shù)端拋出最大調(diào)用堆棧錯(cuò)誤。這是我的代碼exports.signInCart = functions.https.onCall(async (data, context) => { console.log(data) const sessionID = data.sessionID console.log("session id ", sessionID) const shopIntentRef = admin.database().ref('/shopIntent/'+ sessionID) try{ shopIntentRef.once("value", (snapshot)=> { if(!snapshot.val()){ console.log("not recognized ") return "NA" } if(snapshot.val()){ admin.database().ref('/shopintent/'+ sessionID+'/').update(data); return (snapshot.val()); } }); }catch(ex){ console.log('ex /updateCoords = '+ex); } return shopIntentRef.once("value")})我嘗試了幾種不同的方法;我認(rèn)為我應(yīng)該能夠在沒(méi)有最后一個(gè) return 語(yǔ)句的情況下獲得一些值,并且我確實(shí)得到了返回狀態(tài)代碼 200 但沒(méi)有返回 snapshot.val() 。當(dāng)我添加最后一個(gè) return 語(yǔ)句時(shí),它開(kāi)始在 firebase 函數(shù)控制臺(tái)中生成此錯(cuò)誤Unhandled error RangeError: Maximum call stack size exceededat Object (<anonymous>)at /workspace/node_modules/lodash/lodash.js:1198:19at baseKeys (/workspace/node_modules/lodash/lodash.js:3484:16)at keys (/workspace/node_modules/lodash/lodash.js:13333:60)at /workspace/node_modules/lodash/lodash.js:4920:21at baseForOwn (/workspace/node_modules/lodash/lodash.js:2990:24)at Function.mapValues (/workspace/node_modules/lodash/lodash.js:13426:7)at encode (/workspace/node_modules/firebase-functions/lib/providers/https.js:184:18)at /workspace/node_modules/lodash/lodash.js:13427:38at /workspace/node_modules/lodash/lodash.js:4925:15 下午 5:41:07.909我該如何解決上述錯(cuò)誤?
firebase函數(shù)未處理的錯(cuò)誤RangeError:超出最大調(diào)用堆棧大小
繁花如伊
2023-08-24 10:34:18