cloud_functions v 0.4.1+1
Callable cloud functions return DEADLINE_EXCEEDED after 10s on android even if the cloud function executed correctly in firebase console.
Related to
Cloud function example:
export const testCloudFunctionTimeout = functions.https.onCall(async (data, context) =>{
await new Promise(resolve => setTimeout(resolve, 20000));
return true;
});
Flutter callable example
Future<dynamic> testCloudFunction() async{
final HttpsCallable callable = CloudFunctions.instance
.getHttpsCallable(functionName: 'testCloudFunctionTimeout')
..timeout = const Duration(seconds: 60);
final HttpsCallableResult resp = await callable.call();
return resp.data;
}
Output
Instance of 'CloudFunctionException'
DEADLINE_EXCEEDED
Same issue here
Same issue happens here. Cloud Function executes correctly, but still the DEADLINE_EXCEEDED is thrown...
Same issue happens here.
Upgrade to version 0.4.1+8
@mark-veenstra I understand that now setting an explicit timeout works. But if not, it keeps failing.
@AndrsDev On the Flutter side I don't set a timeout and never experience the DEADLINE_EXCEEDED anymore
I am experiencing this issue on ^0.4.1+8 running the example code.
Does anyone have a fix for this while we are waiting for it to be fixed?
@mark-veenstra I understand that now setting an explicit timeout works. But if not, it keeps failing.
Setting the timeout in flutter is not working for me.
Same issue here, Setting the timeout is also not working for me in 0.4.2+3
Edit : Got fixed when I changed the android build.gradle. Change firebase-functions version from 17.0.0 to 19.0.1. api 'com.google.firebase:firebase-functions:19.0.1'
Where exactly did you make this change @KiruthikaAdhi ? I did not have any entry for this before and unsure I put it in the right place?
Neither timeout or the build.gradle update worked for me, given that I do it correctly.
Any update on this issue? Still a problem for me on 0.5.0.
Waiting too. Timeout configuration is imprescindible for small projects using cloud-functions. Sometimes the cold start requires much time and break my functions😞
Okay, I faced the same problem.
These steps solved it:
1. In Android Studio open:
- 'Project Structure' – (Cmnd+;)
- 'Dependencies'
In the tab 'Modules' select 'app',
then 'Declared Dependencies' and click '+',
then 'Library Dependency' -> enter 'firebase-functions'
and select 'com.google.firebase', and version 19.0.0.
2. flutter clean
3. *Go to the '.Library/flutter/.pub-cache/hosted/pub.dartlang.org' and remove all.
4. *flutter pub get
5. flutter run
I think you can skip Step 3 and 4 because the main changes in Step 1.
@christianalfoni Sorry for the delayed response.
I fixed by doing the following,
When you specify cloud functions in pubspec.yaml and run packages get, a copy of cloud functions package will be downloaded in your system. You have change the build.gradle of the downloaded cloud functions package. I changed this file PATH_TO_FLUTTER_SDKflutter.pub-cachehostedpub.dartlang.orgcloud_functions-0.4.2+3androidbuild.gradle. You will find 'com.google.firebase:firebase-functions:17.0.0' if your version is 0.4.2+3. Change that to 'com.google.firebase:firebase-functions:19.0.1'.
Hope this helps.

@KiruthikaAdhi, @artebiakin That works for local development. But for CI/CD tools #2594 must be merged.
@AndrsDev Agreed. Just for time being until 2594 PR is merged, I think you can fork the cloud function repo, make the change in the forked repo and specify the github link of forked repo in pubspec.yaml. For more details checkout this link . I am guessing it may work for CI/CD tools.
@KiruthikaAdhi that worked for me, thanks!
pubspec.yaml
---before---
cloud_functions: 0.5.0
---It worked for me----
cloud_functions:
git:
url: https://github.com/antonino-tocco/flutterfire.git
ref: fix-cloud-functions
path: packages/cloud_functions/cloud_functions/
The last update of cloud function for flutter(^0.6.0) resolver this issue.
@benitogonzalezh I've tested with cloud_functions ^0.6.0 and it actually fixes this issue. I think it can be closed! 🥳
It is working as expected without getting DEADLINE_EXCEEDED error, after migrated the project to latest firebase plugins and clear the cache. Follow the below link for migration.
https://firebase.flutter.dev/docs/migration/
Most helpful comment
Any update on this issue? Still a problem for me on 0.5.0.