Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cloud_firestore: Crashs on release and debug #17196

Open
1 task done
EArminjon opened this issue Mar 13, 2025 · 12 comments · May be fixed by #17197
Open
1 task done

cloud_firestore: Crashs on release and debug #17196

EArminjon opened this issue Mar 13, 2025 · 12 comments · May be fixed by #17197
Labels
blocked: firebase-sdk Needs Attention This issue needs maintainer attention. platform: ios Issues / PRs which are specifically for iOS. plugin: cloud_firestore type: bug Something isn't working

Comments

@EArminjon
Copy link

EArminjon commented Mar 13, 2025

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

No response

Which platforms are affected?

iOS

Description

On iOS Release mode, i can reproduce 2 crashs.
On Android errors are well catched, app didn't crash.

Reproducing the issue

  1. Run app
  2. Click to the first button (crash on prod, not on debug)
  3. Run app
  4. Click to the second button (crash on prod and on debug)
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

import 'firebase_options.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
  FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(true);
  FlutterError.onError = (FlutterErrorDetails errorDetails) {
    FirebaseCrashlytics.instance.recordFlutterFatalError(errorDetails);
  };

  PlatformDispatcher.instance.onError = (Object error, StackTrace stack) {
    FirebaseCrashlytics.instance.recordError(error, stack);
    return true;
  };

  runApp(const App());
}

class App extends StatefulWidget {
  const App({super.key});

  @override
  State<App> createState() => _AppState();
}

class _AppState extends State<App> {
  @override
  Widget build(BuildContext context) {
    return const MaterialApp(home: Home());
  }
}

class Home extends StatelessWidget {
  const Home({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('I love crash')),
      body: Center(
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: <Widget>[
            ElevatedButton(
              onPressed: () async {
                try {
                  await FirebaseFirestore.instance
                      .collection('teams')
                      .doc('')
                      .update(<Object, Object?>{'test': 'test'});
                } catch (err, stack) {
                  debugPrintStack(label: err.toString(), stackTrace: stack);
                  ScaffoldMessenger.of(context)
                    ..hideCurrentSnackBar()
                    ..showSnackBar(SnackBar(content: Text(err.toString())));
                }
              },
              child: const Text('Update an empty id'),
            ),
            ElevatedButton(
              onPressed: () async {
                try {
                  await FirebaseFirestore.instance
                      .collection('teams')
                      .doc('test/test')
                      .update(<Object, Object?>{'test': 'test'});
                } catch (err, stack) {
                  debugPrintStack(label: err.toString(), stackTrace: stack);
                  ScaffoldMessenger.of(context)
                    ..hideCurrentSnackBar()
                    ..showSnackBar(SnackBar(content: Text(err.toString())));
                }
              },
              child: const Text('Update an id which contain a slash'),
            ),
          ],
        ),
      ),
    );
  }
}

Firebase Core version

3.11.0

Flutter Version

3.19.1

Relevant Log Output

No output, crash

Flutter dependencies

Expand Flutter dependencies snippet
Dart SDK 3.7.0
Flutter SDK 3.29.0

dependencies:
- cloud_firestore 5.6.3 [cloud_firestore_platform_interface cloud_firestore_web collection firebase_core firebase_core_platform_interface flutter meta]
- firebase_core 3.11.0 [firebase_core_platform_interface firebase_core_web flutter meta]
- firebase_crashlytics 4.3.2 [firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface flutter stack_trace]
- flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine]

dev dependencies:
- flutter_test 0.0.0 [flutter test_api matcher path fake_async clock stack_trace vector_math leak_tracker_flutter_testing async boolean_selector characters collection leak_tracker leak_tracker_testing material_color_utilities meta source_span stream_channel string_scanner term_glyph vm_service]

transitive dependencies:
- _flutterfire_internals 1.3.51 [collection firebase_core firebase_core_platform_interface flutter meta]
- async 2.12.0 [collection meta]
- boolean_selector 2.1.2 [source_span string_scanner]
- characters 1.4.0
- clock 1.1.2
- cloud_firestore_platform_interface 6.6.3 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface]
- cloud_firestore_web 4.4.3 [_flutterfire_internals cloud_firestore_platform_interface collection firebase_core firebase_core_web flutter flutter_web_plugins]
- collection 1.19.1
- fake_async 1.3.2 [clock collection]
- firebase_core_platform_interface 5.4.0 [collection flutter flutter_test meta plugin_platform_interface]
- firebase_core_web 2.20.0 [firebase_core_platform_interface flutter flutter_web_plugins meta web]
- firebase_crashlytics_platform_interface 3.8.2 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface]
- flutter_web_plugins 0.0.0 [flutter characters collection material_color_utilities meta vector_math]
- leak_tracker 10.0.8 [clock collection meta path vm_service]
- leak_tracker_flutter_testing 3.0.9 [flutter leak_tracker leak_tracker_testing matcher meta]
- leak_tracker_testing 3.0.1 [leak_tracker matcher meta]
- matcher 0.12.17 [async meta stack_trace term_glyph test_api]
- material_color_utilities 0.11.1 [collection]
- meta 1.16.0
- path 1.9.1
- plugin_platform_interface 2.1.8 [meta]
- sky_engine 0.0.0
- source_span 1.10.1 [collection path term_glyph]
- stack_trace 1.12.1 [path]
- stream_channel 2.1.4 [async]
- string_scanner 1.4.1 [source_span]
- term_glyph 1.2.2
- test_api 0.7.4 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph]
- vector_math 2.1.4
- vm_service 14.3.1
- web 1.1.0

Additional context and comments

Crashlytics logs :

          Fatal Exception: FIRInvalidArgumentException
0  CoreFoundation                 0x2d5fc __exceptionPreprocess
1  libobjc.A.dylib                0x31244 objc_exception_throw
2  FirebaseFirestoreInternal      0x47528 (Manquant UUID f2f2392429633c96ae6ae9d4aef0c5e5)
3  FirebaseFirestoreInternal      0x46fe8 (Manquant UUID f2f2392429633c96ae6ae9d4aef0c5e5)
4  FirebaseFirestoreInternal      0x27b8c (Manquant UUID f2f2392429633c96ae6ae9d4aef0c5e5)
5  FirebaseFirestoreInternal      0x38700 (Manquant UUID f2f2392429633c96ae6ae9d4aef0c5e5)
6  FirebaseFirestoreInternal      0x59cd4 (Manquant UUID f2f2392429633c96ae6ae9d4aef0c5e5)
7  FirebaseFirestoreInternal      0x79810 (Manquant UUID f2f2392429633c96ae6ae9d4aef0c5e5)
8  Runner                         0xbe704 -[FLTFirebaseFirestorePlugin documentReferenceUpdateApp:request:completion:] + 410 (FLTFirebaseFirestorePlugin.m:410)
9  Runner                         0xba214 __FirebaseFirestoreHostApiSetup_block_invoke_3.338 + 1132 (FirestoreMessages.g.m:1132)
10 Flutter                        0x5e6cd0 (Manquant UUID 4c4c44be55553144a1f84df5f6252bed)
11 Flutter                        0x6bb1c (Manquant UUID 4c4c44be55553144a1f84df5f6252bed)
12 libdispatch.dylib              0x2248 _dispatch_call_block_and_release
13 libdispatch.dylib              0x3fa8 _dispatch_client_callout
14 libdispatch.dylib              0x12a34 _dispatch_main_queue_drain
15 libdispatch.dylib              0x1264c _dispatch_main_queue_callback_4CF
16 CoreFoundation                 0x79bcc __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
17 CoreFoundation                 0x761c0 __CFRunLoopRun
18 CoreFoundation                 0xc8284 CFRunLoopRunSpecific
19 GraphicsServices               0x14c0 GSEventRunModal
20 UIKitCore                      0x3ee674 -[UIApplication _run]
21 UIKitCore                      0x14e88 UIApplicationMain
22 UIKitCore                      0x75115c keypath_get_selector_hoverStyle
23 Runner                         0x8568 main (AppDelegate.swift)
24 ???                            0x1c8811de8 (Manquant)
@EArminjon EArminjon added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels Mar 13, 2025
@EArminjon EArminjon changed the title cloud_firestore: Crash on release cloud_firestore: Crash on release and debug Mar 13, 2025
@EArminjon EArminjon changed the title cloud_firestore: Crash on release and debug cloud_firestore: Crashs on release and debug Mar 13, 2025
@SelaseKay SelaseKay added plugin: cloud_firestore platform: ios Issues / PRs which are specifically for iOS. labels Mar 13, 2025
@SelaseKay
Copy link
Contributor

Hi @EArminjon, were you able to reproduce this locally by running app in release mode?

@SelaseKay SelaseKay added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels Mar 13, 2025
@EArminjon
Copy link
Author

EArminjon commented Mar 13, 2025

Hello @SelaseKay , I can reproduce everywhere (locally and firebase distribution), on anything (real device and simulators) in release and in debug.

@google-oss-bot google-oss-bot added Needs Attention This issue needs maintainer attention. and removed blocked: customer-response Waiting for customer response, e.g. more information was requested. labels Mar 13, 2025
@EArminjon
Copy link
Author

EArminjon commented Mar 13, 2025

(minor: Issue updated to add missing info about crashlytics)

@EArminjon
Copy link
Author

I well have the same issues and observations using the latest firebase versions :

  cloud_firestore: 5.6.5
  firebase_crashlytics: 4.3.4
  firebase_core: 3.12.1

@MichaelVerdon
Copy link
Contributor

(minor: Issue updated to add missing info about crashlytics)

Hi there @EArminjon can you tell me more about this?

@MichaelVerdon MichaelVerdon added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels Mar 14, 2025
@EArminjon
Copy link
Author

EArminjon commented Mar 14, 2025

(minor: Issue updated to add missing info about crashlytics)

Hi there @EArminjon can you tell me more about this?

What do you need ? I just updated code sample provided to add crashlytics. (It was missing)

@google-oss-bot google-oss-bot added Needs Attention This issue needs maintainer attention. and removed blocked: customer-response Waiting for customer response, e.g. more information was requested. labels Mar 14, 2025
@MichaelVerdon
Copy link
Contributor

MichaelVerdon commented Mar 14, 2025

(minor: Issue updated to add missing info about crashlytics)

Hi there @EArminjon can you tell me more about this?

What do you need ? I just updated code sample provided to add crashlytics. (It was missing)

Hi there, more so about what you meant by what you said, but any details would be nice, as much as you can give for further investigation.

@MichaelVerdon MichaelVerdon added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels Mar 14, 2025
@EArminjon
Copy link
Author

(minor: Issue updated to add missing info about crashlytics)

Hi there @EArminjon can you tell me more about this?

What do you need ? I just updated code sample provided to add crashlytics. (It was missing)

Hi there, more so about what you meant by what you said, but any details would be nice, as much as you can give for further investigation.

I think i've added as much details that i have. Issue is easily reproductible, did you need something ?

@google-oss-bot google-oss-bot added Needs Attention This issue needs maintainer attention. and removed blocked: customer-response Waiting for customer response, e.g. more information was requested. labels Mar 14, 2025
@SelaseKay
Copy link
Contributor

Hi @EArminjon, I'm able to reproduce this issue. We'll investigate further. It appears to be handled well on Android.

@MichaelVerdon
Copy link
Contributor

Hi there @EArminjon I misunderstood what you said but it is okay now. I want to confirm with you that I have also been able to reproduce the issue.

@MichaelVerdon MichaelVerdon linked a pull request Mar 14, 2025 that will close this issue
10 tasks
@MichaelVerdon
Copy link
Contributor

We got a fix up for merging @EArminjon and it should stop the errors from crashing and report it properly like Android side.

@MichaelVerdon
Copy link
Contributor

MichaelVerdon commented Mar 20, 2025

Hi there @EArminjon I just wanted to give you an update. Whilst the issue is solved by the PR, it also happened to be reproducible on the native-sdks hence we may not be able to merge it as it is only a temporary solution to the problem. Therefore I submitted a ticket here. If it is fixed there, it will automatically be fixed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked: firebase-sdk Needs Attention This issue needs maintainer attention. platform: ios Issues / PRs which are specifically for iOS. plugin: cloud_firestore type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants