Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
931 views
in Technique[技术] by (71.8m points)

google cloud functions - Firebase Unhandled error RangeError: Maximum call stack size exceeded

I'm calling a Firebase callable function, and returning the promise as specifed by Firebase, but I get this error:

Unhandled error RangeError: Maximum call stack size exceeded

Here's the code:

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: ' + JSON.stringify(snap));

                   key = Object.keys(snap)[0];
                   node = snap[key];
                   console.log('node: ' + JSON.stringify(node));

                   return(node);
                 });
});

Here's the output that I see in my function log:

snap: {"1538004276":{"description":"This the the Basic product","price":40}}

node: {"description":"This the the Basic product","price":40}

Unhandled error RangeError: Maximum call stack size exceeded
    at Object (native)
    at /user_code/node_modules/firebase-functions/node_modules/lodash/lodash.js:4905:24
    at baseForOwn (/user_code/node_modules/firebase-functions/node_modules/lodash/lodash.js:2996:24)
    at Function.mapValues (/user_code/node_modules/firebase-functions/node_modules/lodash/lodash.js:13401:7)
    at encode (/user_code/node_modules/firebase-functions/lib/providers/https.js:242:18)
    at /user_code/node_modules/firebase-functions/node_modules/lodash/lodash.js:13402:38
    at /user_code/node_modules/firebase-functions/node_modules/lodash/lodash.js:4911:15
    at baseForOwn (/user_code/node_modules/firebase-functions/node_modules/lodash/lodash.js:2996:24)
    at Function.mapValues (/user_code/node_modules/firebase-functions/node_modules/lodash/lodash.js:13401:7)
    at encode (/user_code/node_modules/firebase-functions/lib/providers/https.js:242:18)
    at /user_code/node_modules/firebase-functions/node_modules/lodash/lodash.js:13402:38
    at /user_code/node_modules/firebase-functions/node_modules/lodash/lodash.js:4911:15
    at baseForOwn (/user_code/node_modules/firebase-functions/node_modules/lodash/lodash.js:2996:24)
    at Function.mapValues (/user_code/node_modules/firebase-functions/node_modules/lodash/lodash.js:13401:7)
    at encode (/user_code/node_modules/firebase-functions/lib/providers/https.js:242:18)
    at /user_code/node_modules/firebase-functions/node_modules/lodash/lodash.js:13402:38
    at /user_code/node_modules/firebase-functions/node_modules/lodash/lodash.js:4911:15
    at baseForOwn (/user_code/node_modules/firebase-functions/node_modules/lodash/lodash.js:2996:24)
    at Function.mapValues (/user_code/node_modules/firebase-functions/node_modules/lodash/lodash.js:13401:7)
    at encode (/user_code/node_modules/firebase-functions/lib/providers/https.js:242:18)
    at /user_code/node_modules/firebase-functions/node_modules/lodash/lodash.js:13402:38
    at /user_code/node_modules/firebase-functions/node_modules/lodash/lodash.js:4911:15
    at baseForOwn (/user_code/node_modules/firebase-functions/node_modules/lodash/lodash.js:2996:24)
    at Function.mapValues (/user_code/node_modules/firebase-functions/node_modules/lodash/lodash.js:13401:7)

Help!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...