Skip to content

🐛 [firebase_core_web] flutterfire_ignore_scripts and firebase_core is not defined #12204

@mwoelk

Description

@mwoelk

Bug report

Describe the bug
To comply with GDPR we are not allowed to load any scripts from a third party domain such as *.gstatic.com. Because in this case, the IP address of the user which is deemed personal information is handed over to a third party without the users consent.

Because of this, I wanted to use flutterfire_ignore_scripts as described in the setup docs.

I downloaded the js files and added them to my web/index.html.

    <script src="./vendor/firebase-app.js"></script>
    <script src="./vendor/firebase-messaging.js"></script>

I also added the following line before flutter gets loaded.

window.flutterfire_ignore_scripts = ["core", "messaging"];

Now I get an error in the console stating firebase_core is not defined

Steps to reproduce

Steps to reproduce the behavior:

  1. Add firebase + firebase messaging to the project
  2. download the firebase-app.js and firebase-messaging.js scripts and add them manually to web/index.html
  3. Add the window.flutterfire_ignore_scriptsline to the file as well
  4. Build and open the web app. Check the console to see the error

Expected behavior

firebase_core should be defined when manually including the scripts.

Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand
Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel stable, 3.13.5, on macOS 14.2.1 23C71 darwin-x64, locale en-DE)
    ! Warning: `dart` on your path resolves to /usr/local/Cellar/dart/3.0.4/libexec/bin/dart, which is not inside your current Flutter SDK checkout at /Users/woelkmax/fvm/versions/3.13.5. Consider adding /Users/woelkmax/fvm/versions/3.13.5/bin to the front of your path.
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] VS Code (version 1.85.1)
[✓] Connected device (4 available)
[✓] Network resources

! Doctor found issues in 1 category.

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