Rajendra Kumar
Rajendra Kumar

Reputation: 51

Error: function crashed out of request scope Function killed

When I am importing more than 300 record in firebase using google cloud function than am getting error :

Upvotes: 5

Views: 6666

Answers (3)

Leonard Cremer
Leonard Cremer

Reputation: 96

I had the same problem and it ended up being a problem with the mysql connection I was using in the project.

In this case I used https://www.npmjs.com/package/mysql2 and the system was losing connections to the database.

It was not clear where it was happening and I got the following errors and no indication where the problem was occurring. - Error: function crashed out of request scope Function killed. - Function execution took 31903 ms, finished with status: 'connection error'

Placing try..catch around the database calls revealed the correct error and location where it was happening.

Upvotes: 1

stackovermat
stackovermat

Reputation: 435

Without a glimpse into your code, I only can guess. "Function crashed outside of request scope" indicates that the cloud function had finished before the asynchronous function(s) did. See for documentation for handling async functions and promises: https://firebase.google.com/docs/functions/terminate-functions

Take a closer look at your returns. Make sure you don't forget to return the promise to functions. For an example see also here: https://github.com/firebase/firebase-functions/issues/18#issuecomment-288375709

Upvotes: 11

fresh mouse
fresh mouse

Reputation: 392

Yout might have gone passed a limit, please look at https://firebase.google.com/docs/database/usage/limits.

If this is the case, you could use multiple databases.

Upvotes: -1

Related Questions