Skip to content Skip to sidebar Skip to footer

Vue And Firebase Issue: Error: Function Crashed Out Of Request Scope Function Invocation Was Interrupted

I have seen this question asked, but with no good answer. I can understand what the issue is, but can't seem to find out how to remedy it. Here is my function: //set JSON content t

Solution 1:

You have to use the promise that's returned from this:

db.collection('games')
  .where('accountId', '==', accountId)
  .get()

This is an asynchronous call, and it returns immediately with a promise that becomes resolved when the work is complete.

You need to use that promise to send the response at the right time:

const proimise = db.collection('games')
  .where('accountId', '==', accountId)
  .get()

promise.then(snapshot => {
    // work with the document snapshot here, and send your response
})
.catch(error => {
    // deal with any errors if necessary.
    response.status(500).send(error)
})

The way you're sending the response seems OK, you just need to wait till the fetch is done.

Post a Comment for "Vue And Firebase Issue: Error: Function Crashed Out Of Request Scope Function Invocation Was Interrupted"