firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.44k stars 3.91k forks source link

[firebase_core]: Error Encountered After Upgrading Firebase Core to v2.30.1: Invalid Conditional Import in _flutterfire_internals Package #12708

Open isaacadariku opened 3 weeks ago

isaacadariku commented 3 weeks ago

Is there an existing issue for this?

Which plugins are affected?

Core

Which platforms are affected?

No response

Description

After upgrading Firebase Core from version 2.27.0 to version 2.30.1, running the build runner resulted in the following error in the log output.

The error originates from the _flutterfire_internals package v1.3.32. Downgrading the package to v1.3.31 by overriding it, resolved the error. It's noted that the error was addressed in a merged pull request: PR #12698, which was released in version 1.3.32.

Expected Behavior

The build runner should execute without errors.

Current Behavior

The build runner fails with the reported error.

Reproducing the issue

Upgrade Firebase Core to version 2.30.1. Using the latest build_runner: ^2.4.9 Run the build runner dart run build_runner build --delete-conflicting-outputs

Firebase Core version

2.30.1

Flutter Version

3.19.6

Relevant Log Output

[SEVERE] build_modules:module_library on package:_flutterfire_internals/_flutterfire_internals.dart (cached):

Invalid argument(s): Unsupported conditional import of `dart:js_interop` found in _flutterfire_internals|lib/_flutterfire_internals.dart:

import 'src/interop_shimmer.dart' if (dart.library.js_interop) 'dart:js_interop' as js_interop;

This environment does not support direct conditional imports of `dart:` libraries. Instead you must create a separate library which unconditionally imports (or exports) the `dart:` library that you want to use, and conditionally import (or export) that library.
[SEVERE] Failed after 1m 28s

Flutter dependencies

Expand Flutter dependencies snippet
```yaml Replace this line with the contents of your `flutter pub deps -- --style=compact`. ```

Additional context and comments

No response

Lyokone commented 3 weeks ago

Thanks for the report I'm looking into it, have you tried to exclude this particular file in your build.yaml file?

Lyokone commented 3 weeks ago

Screenshot 2024-04-26 at 10 18 12

I cannot reproduce the issue, could you give a complete sample?

alex-dokienko commented 3 weeks ago

hello @Lyokone ,

my comment not related to mentioned issue, but if I can please ask to do another version release to include 10.11.1 firebase js library https://firebase.google.com/support/release-notes/js to resolve following issue https://github.com/firebase/firebase-js-sdk/pull/8145 which is long running annoying problem for my flutter app, please help 🙏

rokk4 commented 3 weeks ago

Same error here:

Deprecated. Use `dart run` instead.
[INFO] Generating build script completed, took 188ms
[INFO] Setting up file watchers completed, took 4ms
[INFO] Waiting for all file watchers to be ready completed, took 676ms
[INFO] Reading cached asset graph completed, took 876ms
[INFO] Checking for updates since last build completed, took 1.1s
[INFO] Running build completed, took 247ms
[INFO] Caching finalized dependency graph completed, took 898ms
[SEVERE] build_modules:module_library on package:_flutterfire_internals/_flutterfire_internals.dart (cached):

Invalid argument(s): Unsupported conditional import of `dart:js_interop` found in _flutterfire_internals|lib/_flutterfire_internals.dart:

import 'src/interop_shimmer.dart' if (dart.library.js_interop) 'dart:js_interop' as js_interop;

This environment does not support direct conditional imports of `dart:` libraries. Instead you must create a separate library which unconditionally imports (or exports) the `dart:` library that you want to use, and conditionally import (or export) that library.
[SEVERE] Failed after 1.2s

@Lyokone pinning 2.30.0 solves it.

  firebase_core: 2.30.0
  firebase_messaging: ^14.8.0
elitree commented 2 weeks ago

I ran into this too. Updating to the latest versions of all the Flutter Firebase packages solved the error for me.

elitree commented 2 weeks ago

For some reason, updating to the latest Firebase packages worked earlier, but now I'm getting the same error again, even with all the latest packages.

Pinning _flutterfire_internals to 1.3.31 solves the error for me.

google-oss-bot commented 1 week ago

Hey @isaacadariku. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

ciprig commented 1 week ago

The issue still happen with firebase_core: 2.31.0

isaacadariku commented 1 week ago

@Lyokone Thanks for the response. I have not tried excluding the file in the build.yaml file. Can you provide an example of excluding the file in the build.yaml file? As this file is part of the _flutterfire_internals package, I am not sure how to exclude it.

I will try to create a sample project to reproduce the issue and share it with you.