Skip to content

[cloud_functions]: Getting DEADLINE_EXCEEDED but no trace of the call on the backend #16741

@orestesgaolin

Description

@orestesgaolin

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

Cloud Functions

Which platforms are affected?

Android, iOS

Description

We are happy users of cloud_functions SDK but sometimes it happens that the library just stops executing calls to callable functions, even though:

  • it was working just fine few minutes before
  • Firebase Auth token is valid
  • other users can access the function just fine, even from the same network

The error thrown is just DEADLINE_EXCEEDED after the specified time

I/flutter (15750): [CloudFunctionsClient] [firebase_functions/deadline-exceeded] DEADLINE_EXCEEDED
I/flutter (15750): [CloudFunctionsClient] 
I/flutter (15750): [CloudFunctionsClient] #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:648:7)
I/flutter (15750): [CloudFunctionsClient] #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:334:18)
I/flutter (15750): [CloudFunctionsClient] <asynchronous suspension>
I/flutter (15750): [CloudFunctionsClient] #2      MethodChannelHttpsCallable.call (package:cloud_functions_platform_interface/src/method_channel/method_channel_https_callable.dart:22:24)
I/flutter (15750): [CloudFunctionsClient] <asynchronous suspension>
I/flutter (15750): [CloudFunctionsClient] #3      HttpsCallable.call (package:cloud_functions/src/https_callable.dart:49:37)
I/flutter (15750): [CloudFunctionsClient] <asynchronous suspension>
I/flutter (15750): [CloudFunctionsClient] #4      CloudFunctionsClient.appLaunch (package:cloud_functions_client/src/cloud_functions_client.dart:775:22)
I/flutter (15750): [CloudFunctionsClient] <asynchronous suspension>
...
I/flutter (15750): [CloudFunctionsClient] 
I/flutter (15750): [CloudFunctionsClient] #0   StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:648:7)
I/flutter (15750): [CloudFunctionsClient] #1   MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:334:18)
I/flutter (15750): [CloudFunctionsClient] #2   <asynchronous suspension>
I/flutter (15750): [CloudFunctionsClient] #3   MethodChannelHttpsCallable.call (package:cloud_functions_platform_interface/src/method_channel/method_channel_https_callable.dart:22:24)
I/flutter (15750): [CloudFunctionsClient] #4   <asynchronous suspension>
I/flutter (15750): [CloudFunctionsClient] #5   HttpsCallable.call (package:cloud_functions/src/https_callable.dart:49:37)
I/flutter (15750): [CloudFunctionsClient] #6   <asynchronous suspension>
I/flutter (15750): [CloudFunctionsClient] #7   CloudFunctionsClient.appLaunch (package:cloud_functions_client/src/cloud_functions_client.dart:775:22)
I/flutter (15750): [CloudFunctionsClient] ⛔ appLaunch failed

Reproducing the issue

It's quite tricky to reproduce the issue, it may happen during debugging, but when it occurs it's just difficult to capture any debug traces outside of the above exception.

My implementation typically is quite simple

      final user = firebaseAuth.currentUser;
      if (user == null) {
        throw Exception('User is not authenticated');
      }

      // check if token is valid
      final tokenResult = await user.getIdTokenResult();
      if (tokenResult.token == null) {
        throw Exception('User token is not valid');
      }

      final result = await functions
          .httpsCallable(
        'nameOfTheFunction',
        options: HttpsCallableOptions(timeout: const Duration(seconds: 30)),
      )
          .call<Map<String, dynamic>>(
        {
          'appBuild': appBuild,
          'userAgent': userAgent,
        },
      );

Firebase Core version

2.31.1

Flutter Version

3.24.4

Relevant Log Output

No response

Flutter dependencies

Expand Flutter dependencies snippet
Dart SDK 3.5.4
Flutter SDK 3.24.4
visible_app 24.11.3

dependencies:

- cloud_functions_client 1.0.0+1 [cloud_functions equatable firebase_auth flutter json_annotation log watcher]
- cloud_storage_client 1.0.0+1 [equatable file firebase_auth firebase_storage flutter log path rxdart]
- firebase_auth 4.19.6 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta]
- firebase_core 2.31.1 [firebase_core_platform_interface firebase_core_web flutter meta]
- firebase_crashlytics 3.4.18 [firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface flutter stack_trace]
- firebase_messaging 14.9.0 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta]
- flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine]


transitive dependencies:

- cloud_functions 4.7.5 [cloud_functions_platform_interface cloud_functions_web firebase_core firebase_core_platform_interface flutter]
- cloud_functions_platform_interface 5.5.27 [firebase_core flutter meta plugin_platform_interface]
- cloud_functions_web 4.9.5 [cloud_functions_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins]
- firebase_auth_platform_interface 7.2.7 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface]
- firebase_auth_web 5.11.6 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser meta web]
- firebase_core_platform_interface 5.0.0 [collection flutter flutter_test meta plugin_platform_interface]
- firebase_core_web 2.17.0 [firebase_core_platform_interface flutter flutter_web_plugins meta web]
- firebase_crashlytics_platform_interface 3.6.25 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface]
- firebase_dynamic_links 5.4.17 [firebase_core firebase_core_platform_interface firebase_dynamic_links_platform_interface flutter meta plugin_platform_interface]
- firebase_dynamic_links_platform_interface 0.2.6+25 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface]
- firebase_messaging_platform_interface 4.5.33 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface]
- firebase_messaging_web 3.8.3 [_flutterfire_internals firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins meta web]
- firebase_storage 11.7.6 [firebase_core firebase_core_platform_interface firebase_storage_platform_interface firebase_storage_web flutter]
- firebase_storage_platform_interface 5.1.21 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface]
- firebase_storage_web 3.9.6 [_flutterfire_internals async firebase_core firebase_core_web firebase_storage_platform_interface flutter flutter_web_plugins http meta web]
- http_multi_server 3.2.1 [async]
- http_parser 4.0.2 [collection source_span string_scanner typed_data]
- http_profile 0.1.0

Additional context and comments

I know that my firebase sdk is quite old compared to the current version, but maybe something comes to your mind that could potentially explain the issue? Do you recall any fixes between 2.31.1 and current version that could resolve it? Migrating to the current version would be a bit inconvenient for us right now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions