Skip to content

[Firebase_core]: Firebase_core not initialized in web release #17111

Description

@MedAliHaBloomwell

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

Core

Which platforms are affected?

Web

Description

when we build our app in debug mode everything work as expected but when we prepared to deploy and test release or even on prod we get this issue TypeError: Cannot read properties of undefined (reading 'getApps')
and firebase_core.js file not loaded at all in release mode
we are using latest firebase_core version

Reproducing the issue

build the app in release mode

our initialization below , it was working as expected when we used 3.6.0 with flutter version 3.24 after upgrade to latest version
things start to blow up

Expand Flutter initialization snippet
try {
if (Firebase.apps.isEmpty) {
  await Firebase.initializeApp(options: firebaseOptions);
  debugPrint('completedAppInitialize');
}

} catch (e, trace) {
debugPrint('error: $e');
debugPrint('trace: $trace');
}

Firebase Core version

3.11.0

Flutter Version

3.29.0

Relevant Log Output

TypeError: Cannot read properties of undefined (reading 'getApps')

Flutter dependencies

Expand Flutter dependencies snippet
- firebase_analytics_platform_interface 4.3.2 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface]
- firebase_analytics_web 0.5.10+8 [_flutterfire_internals firebase_analytics_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins]
- firebase_core_platform_interface 5.4.0 [collection flutter flutter_test meta plugin_platform_interface]
- firebase_messaging_platform_interface 4.6.2 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface]
- firebase_messaging_web 3.10.2 [_flutterfire_internals firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins meta web]
- firebase_remote_config_platform_interface 1.5.0 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface]
- firebase_remote_config_web 1.8.0 

Additional context and comments

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs AttentionThis issue needs maintainer attention.platform: webIssues / PRs which are specifically for web.plugin: coretype: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions