File tree 1 file changed +14
-0
lines changed
1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 1
1
import admin from "firebase-admin" ;
2
2
3
3
const test = async ( req , res ) => {
4
+ // Get function context to avoid timeout
5
+ // See: https://github.com/netlify/next-on-netlify/issues/66#issuecomment-719988804
6
+ const functionContext = req ?. functionContext ;
7
+
8
+ // If we are currently in a Netlify function (deployed on netlify.app or
9
+ // locally with netlify dev), do not wait for empty event loop.
10
+ // See: https://stackoverflow.com/a/39215697/6451879
11
+ // Skip during next dev.
12
+ if ( functionContext ) {
13
+ console . log ( "Setting callbackWaitsForEmptyEventLoop: false" ) ;
14
+ functionContext . callbackWaitsForEmptyEventLoop = false ;
15
+ }
16
+
17
+ // Initialize firebase app
4
18
if ( ! admin . apps . length ) {
5
19
admin . initializeApp ( {
6
20
credential : admin . credential . cert ( {
You can’t perform that action at this time.
0 commit comments