Describe the bug
When the user signs in with google in my flutter app it signs in successfully, I can see it the console's authentication page. After signing in I search the document with the user's data in firestore, if it is a new user the method returns null and creates a new document with the data. It works fine when I'm working in debug mode but when I'm in release mode the document for new users isn't created in firestore and it doesn't throw any error.
Everything works as it would when I'm in debug mode with the debug SHA certificate. But when I'm in release mode with the release SHA certificate, the user is created in the console's authentication page, but the document in firestore with the user's data isn't created. I've attached a pdf with the code
Steps to reproduce the behavior:
I would spect the doc gets created with the uid as its id in the collection in firestore, however it isn't created.
Add any other context about the problem here.
Run flutter doctor and paste the output below:
Click To Expand
Doctor summary (to see all details, run flutter doctor -v):
[โ] Flutter (Channel stable, 1.20.3, on Mac OS X 10.15.6 19G2021, locale es-EC)
[โ] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[โ] Xcode - develop for iOS and macOS (Xcode 11.6)
[โ] Android Studio (version 4.0)
[โ] Connected device (1 available)
โข No issues found!
[Code.pdf](https://github.com/FirebaseExtended/flutterfire/files/5228749/Code.pdf)
Run flutter pub deps -- --style=compact and paste the output below:
Click To Expand
Dart SDK 2.9.2
Flutter SDK 1.20.3
pickapp_cliente_1 0.5.4+24
dependencies:
- cloud_firestore 0.14.0+2 [flutter meta quiver firebase_core firebase_core_platform_interface cloud_firestore_platform_interface cloud_firestore_web]
- convert 2.1.1 [charcode typed_data]
- crypto 2.1.5 [collection convert typed_data]
- cupertino_icons 0.1.3
- device_info 0.4.2+7 [flutter device_info_platform_interface]
- firebase_analytics 6.0.0 [meta flutter firebase_core firebase_analytics_web firebase_analytics_platform_interface]
- firebase_auth 0.18.0+1 [meta firebase_core firebase_core_platform_interface firebase_auth_platform_interface firebase_auth_web flutter]
- firebase_core 0.5.0 [firebase_core_platform_interface flutter quiver meta firebase_core_web]
- firebase_messaging 7.0.0 [meta platform flutter firebase_core]
- flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine]
- flutter_spinkit 4.1.2+1 [flutter]
- geocoding 1.0.3 [flutter geocoding_platform_interface url_launcher]
- geolocator 6.0.0+4 [flutter geolocator_platform_interface]
- google_maps_flutter 0.5.31 [flutter flutter_plugin_android_lifecycle google_maps_flutter_platform_interface]
- google_sign_in 4.5.3 [google_sign_in_platform_interface flutter meta google_sign_in_web]
- maps_launcher 1.2.2+1 [flutter flutter_web_plugins url_launcher]
- notification_permissions 0.4.7 [flutter]
- overlay_support 1.0.5 [flutter async]
- provider 4.3.2+2 [flutter nested collection]
- shared_preferences 0.5.10 [meta flutter shared_preferences_platform_interface shared_preferences_linux shared_preferences_macos shared_preferences_web]
- sign_in_with_apple 2.5.2 [meta flutter]
- url_launcher 5.5.2 [flutter url_launcher_platform_interface url_launcher_web url_launcher_linux url_launcher_macos]
dev dependencies:
- flutter_launcher_icons 0.7.5 [image args yaml]
- flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher meta source_span stream_channel string_scanner term_glyph typed_data]
transitive dependencies:
- archive 2.0.13 [crypto args path]
- args 1.6.0
- async 2.4.2 [collection]
- boolean_selector 2.0.0 [source_span string_scanner]
- characters 1.0.0
- charcode 1.1.3
- clock 1.0.1 [meta]
- cloud_firestore_platform_interface 2.0.1 [flutter meta collection firebase_core plugin_platform_interface]
- cloud_firestore_web 0.2.0+1 [flutter flutter_web_plugins firebase http_parser meta firebase_core cloud_firestore_platform_interface js]
- collection 1.14.13
- device_info_platform_interface 1.0.0 [flutter meta plugin_platform_interface]
- fake_async 1.1.0 [clock collection]
- file 5.2.1 [intl meta path]
- firebase 7.3.0 [http http_parser js]
- firebase_analytics_platform_interface 1.0.3 [flutter meta]
- firebase_analytics_web 0.1.1 [flutter flutter_web_plugins firebase firebase_analytics_platform_interface meta]
- firebase_auth_platform_interface 2.0.1 [flutter meta firebase_core plugin_platform_interface]
- firebase_auth_web 0.3.0+1 [flutter flutter_web_plugins firebase meta http_parser intl firebase_core firebase_auth_platform_interface js]
- firebase_core_platform_interface 2.0.0 [flutter meta plugin_platform_interface quiver]
- firebase_core_web 0.2.0 [firebase firebase_core_platform_interface flutter flutter_web_plugins meta js]
- flutter_plugin_android_lifecycle 1.0.8 [flutter]
- flutter_web_plugins 0.0.0 [flutter characters collection meta typed_data vector_math]
- geocoding_platform_interface 1.0.0+3 [flutter meta plugin_platform_interface]
- geolocator_platform_interface 1.0.4 [flutter meta plugin_platform_interface vector_math]
- google_maps_flutter_platform_interface 1.0.4 [flutter meta plugin_platform_interface stream_transform]
- google_sign_in_platform_interface 1.1.2 [flutter meta quiver]
- google_sign_in_web 0.9.1+1 [google_sign_in_platform_interface flutter flutter_web_plugins meta js]
- http 0.12.2 [http_parser path pedantic]
- http_parser 3.1.4 [charcode collection source_span string_scanner typed_data]
- image 2.1.14 [archive xml]
- intl 0.16.1 [path]
- js 0.6.2
- matcher 0.12.8 [stack_trace]
- meta 1.1.8
- nested 0.0.4 [flutter]
- path 1.7.0
- path_provider_linux 0.0.1+2 [path xdg_directories path_provider_platform_interface flutter]
- path_provider_platform_interface 1.0.3 [flutter meta platform plugin_platform_interface]
- pedantic 1.9.0
- petitparser 3.0.4 [meta]
- platform 2.2.1
- platform_detect 1.4.0 [meta pub_semver]
- plugin_platform_interface 1.0.2 [meta]
- process 3.0.13 [file intl meta path platform]
- pub_semver 1.4.4 [collection]
- quiver 2.1.3 [matcher meta]
- shared_preferences_linux 0.0.2+2 [file flutter meta path path_provider_linux shared_preferences_platform_interface]
- shared_preferences_macos 0.0.1+10 [shared_preferences_platform_interface flutter]
- shared_preferences_platform_interface 1.0.4 [meta flutter]
- shared_preferences_web 0.1.2+7 [shared_preferences_platform_interface flutter flutter_web_plugins meta]
- sky_engine 0.0.99
- source_span 1.7.0 [charcode collection meta path term_glyph]
- stack_trace 1.9.5 [path]
- stream_channel 2.0.0 [async]
- stream_transform 1.2.0
- string_scanner 1.0.5 [charcode meta source_span]
- term_glyph 1.1.0
- test_api 0.2.17 [async boolean_selector collection meta path source_span stack_trace stream_channel string_scanner term_glyph matcher]
- typed_data 1.2.0 [collection]
- url_launcher_linux 0.0.1+1 [flutter]
- url_launcher_macos 0.0.1+7 [flutter]
- url_launcher_platform_interface 1.0.8 [flutter meta plugin_platform_interface]
- url_launcher_web 0.1.3+1 [url_launcher_platform_interface platform_detect flutter flutter_web_plugins meta]
- vector_math 2.0.8
- xdg_directories 0.1.0 [path process flutter]
- xml 4.2.0 [collection convert meta petitparser]
- yaml 2.2.1 [charcode collection string_scanner source_span]
Hi @davidsebastianfp
Can you please provide a minimal complete reproducible code sample
Thank you
Hi @TahaTesser in this link is a project that reproduces the error
https://drive.google.com/file/d/15gnF54co86dCNfYoaAEKX9jJNzllf7fB/view?usp=sharing
Hi @davidsebastianfp
Thanks for providing a code sample, it does create firestore docs in debug mode but the app is stuck on this screen in release mode and firestore docs are not created. Is this the same behaviour experiencing?

[ +4 ms] Application running.
[ +3 ms] Flutter run key commands.
[ +2 ms] h Repeat this help message.
[ +1 ms] c Clear the screen
[ ] q Quit (terminate the application on the device).
[ +296 ms] I/flutter (15874): wrapper -> built
[+272200 ms] I/flutter (15874): wrapper -> built
[ ] I/flutter (15874): wrapper -> the user is logged in
[ ] I/flutter (15874): home -> built
[+1108 ms] I/flutter (15874): database -> getUserData: get data del usuario: UQwM7TPtB9ZrTNZ74aBcNIQsE7h2
[ ] I/flutter (15874): auth -> getUserDataFromFirestore: The user doesn't exist, so we create a new one with this
data: email: [email protected], nombre: Taha Baig, token: simulated token it doesnt matter here, telefono: null, tipo: 3,
uid: UQwM7TPtB9ZrTNZ74aBcNIQsE7h2
[ ] I/flutter (15874): sign_in -> user logged in with google, this is its id UQwM7TPtB9ZrTNZ74aBcNIQsE7h2
Hi @TahaTesser yes it is the behavior I'm experiencing. It gets stuck because the app is waiting the document to be created but for some reason it is not. As you see in debug mode the doc is created and the app continues normally
Hello @TahaTesser , do you have any updates about this?
Does the Google's Authentication Screen comes up in release mode?
@Adarsh0603 yes it does, in fact I log in but i can't create a doc in firestore
Did you downloaded the googleservices.json file again with the release sha1 key in firebase...
In your firebase project settings you have to update the SHA certificated fingerprints with the release SHA 1 key
and redownload the googleservices.json and add it to your app.

@Adarsh0603 Yes I did, that is why I can log in. When I try to use the the debug key an error is thrown
@Adarsh0603 so what sould I do. Is anybody trying to fix this error?
@davidsebastianfp okay it worked...actually the problem is with the assert statements...
the assertions only work in debug mode and are disabled in release mode.

You can read more about it here (https://flutter.dev/docs/testing/build-modes).
You need to call the functions without the assert statements..

Most helpful comment
Hi @TahaTesser yes it is the behavior I'm experiencing. It gets stuck because the app is waiting the document to be created but for some reason it is not. As you see in debug mode the doc is created and the app continues normally