Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 :

  • Error: function crashed out of request scope Function killed.
  • Function execution took 31903 ms, finished with status: 'connection error'
like image 867
Rajendra Kumar Avatar asked Aug 09 '17 07:08

Rajendra Kumar


2 Answers

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

like image 119
stackovermat Avatar answered Nov 04 '22 14:11

stackovermat


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.

like image 44
Leonard Cremer Avatar answered Nov 04 '22 14:11

Leonard Cremer