FirebaseExtended / angularfire

AngularJS bindings for Firebase

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

callable functions throw deadline-exceeded even though the function was defined with max timeout in nodes

pdemilly opened this issue · comments

Version info

Angular:

Angular CLI: 7.3.8
Node: 8.15.1
OS: linux x64
Angular: 8.2.2

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.802.2
@angular-devkit/build-angular     0.802.2
@angular-devkit/build-optimizer   0.802.2
@angular-devkit/build-webpack     0.802.2
@angular-devkit/core              8.2.2
@angular-devkit/schematics        8.2.2
@angular/cdk                      8.1.3
@angular/fire                     5.2.1
@angular/flex-layout              7.0.0-beta.24
@angular/http                     7.2.15
@angular/material                 8.1.3
@ngtools/webpack                  8.2.2
@schematics/angular               8.2.2
@schematics/update                0.802.2
rxjs                              6.5.2
typescript                        3.5.3
webpack                           4.38.0

Firebase:

"firebase": "^6.4.0",
"firebase-functions": "^3.2.0",
"@types/firebase": "^3.2.1",

AngularFire:

"@angular/fire": "^5.2.0-rc.3",

Other (e.g. Node, browser, operating system) (if applicable):

Test case

Steps to reproduce

in Angular

return this.cloudFunctions.httpsCallable('myNodeFunction' ({ someArgs:''}).pipe (
tap (result => console.log (result);
)

in node

exports.myNodeFunction = functions.runWith ({ timeoutSeconds: functions.MAX_TIMEOUT_SECONDS }).https.onCall ((data, context): Promise => {
return setTimeout (() => 'function completed successfully', 3 * 60 * 1000);
});

Expected behavior

get "function completed successfully" on console

Actual behavior

get an error after a minute

error Error: deadline-exceeded
    at new HttpsErrorImpl (index.cjs.js:59)
    at index.cjs.js:365
    at ZoneDelegate.invokeTask (zone-evergreen.js:391)
    at Zone.runTask (zone-evergreen.js:168)
    at invokeTask (zone-evergreen.js:465)
    at ZoneTask.invoke (zone-evergreen.js:454)
    at timer (zone-evergreen.js:2650)
ngxs-logger-plugin.js:118  error Error: deadline-exceeded
    at new HttpsErrorImpl (index.cjs.js:59)
    at index.cjs.js:365
    at ZoneDelegate.invokeTask (zone-evergreen.js:391)
    at Zone.runTask (zone-evergreen.js:168)
    at invokeTask (zone-evergreen.js:465)
    at ZoneTask.invoke (zone-evergreen.js:454)
    at timer (zone-evergreen.js:2650)

I am getting the same issue after 60s although I have defined timeoutSeconds: 300. According to the logs the function completes with no errors at around 72s.
"@angular/fire": "^5.2.1",

I had the same issue. But I found a solution using the firebase JS SDK. There are 2 timeouts you can handle, one for the function that runs in the server and other for the client. For the client you can pass a timeout in the JS SDK functions().httpsCallable(functionName, {timeout: 300000});. The functions.HttpsCallableOptions parameter is not available in AngularFire 6.0.0.