我正在调用 Firebase 可调用函数,并返回 Firebase 指定的承诺,但出现此错误:
未处理的错误 RangeError:超出最大调用堆栈大小
这是代码:
exports.getProductInfo = functions.https.onCall((data, context) => {
// Message text passed from the client.
const product = data.product;
// Authentication / user information is automatically added to the request.
// const uid = context.auth.uid;
// Get the current Server Timestamp
var ts = String(Date.now());
var key, snap, node;
// Get the price of the specified product
return database.ref('/products/' + product)
.orderByKey()
.endAt(ts)
.limitToLast(1)
.once('value', function (snapshot) {
snap = snapshot.val();
console.log('snap: ' + …Run Code Online (Sandbox Code Playgroud)