Skip to content

🐛 [firebase_core_web] is throwing an exception when running in debug mode and asking the IDE to catch all exceptions #11525

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

Closed
wer-mathurin opened this issue Aug 29, 2023 · 9 comments
Labels
blocked: flutter closed-by-bot resolution: no-response Customer did not respond after some time. Stale Issue with no recent activity triage Issue is currently being triaged. type: bug Something isn't working

Comments

@wer-mathurin
Copy link
Contributor

Bug report

In production is not a problem, the exception is not preventing the application to crash...but when debuging code (in VS code) is very common to is very common to activate:
image

and you will get this error:
image

Describe the bug
A clear and concise description of what the bug is.

Steps to reproduce

Run the app with device Chrome.

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await Firebase.initializeApp(
    options: DefaultFirebaseOptions.currentPlatform,
  );

  runApp(const App());
}

class App extends StatelessWidget {
  const App({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container();
  }
}

Expected behavior

Current code that interpreted as Uncaught Exceptions in VS Code and this look strange since this is catched!

List<String> get _ignoredServiceScripts {
   try {
     JsObject ignored =
         JsObject.fromBrowserObject(context['flutterfire_ignore_scripts']);

     if (ignored is Iterable) {
       return (ignored as Iterable)
           .map((e) => e.toString())
           .toList(growable: false);
     }
   } catch (e) {
     // Noop
   }

   return [];
 }

But if we want to resolve this we can always do this:

List<String> get _ignoredServiceScripts {
   try {
     final ignoreScripts = context['flutterfire_ignore_scripts'];
     if (ignoreScripts == null) return [];

     JsObject ignored = JsObject.fromBrowserObject(ignoreScripts);

     if (ignored is Iterable) {
       return (ignored as Iterable)
           .map((e) => e.toString())
           .toList(growable: false);
     }
   } catch (e) {
     // Noop
   }

   return [];
 }
@wer-mathurin wer-mathurin added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels Aug 29, 2023
@darshankawar darshankawar added the triage Issue is currently being triaged. label Aug 30, 2023
@darshankawar
Copy link

Thanks for the report @wer-mathurin
Can you take a look at #10468 and underlying comments and see if they help in your case or not ?

@darshankawar darshankawar added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels Aug 30, 2023
@wer-mathurin
Copy link
Contributor Author

@darshankawar that's my point, the latest solution identified in the ticket you referenced is not working as expected. Uncaught exception still bring us to the failing code !

But we can argue that relying on exception to detect undefined value in the configuration is not self explanatory.

This is an easy PR to do and will make the code more.clear to me and solve this issue that is raised multiple time.

Any thoughts?

@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 Aug 30, 2023
@darshankawar
Copy link

Thanks for the feedback @wer-mathurin
I am wondering if this is related to dart specifically and it's effect rippled to flutterfire plugins. See dart-lang/sdk#53334 and check if it helps further or not.

@darshankawar darshankawar added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels Aug 30, 2023
@google-oss-bot google-oss-bot added the Stale Issue with no recent activity label Sep 8, 2023
@google-oss-bot
Copy link

Hey @wer-mathurin. 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!

@wer-mathurin
Copy link
Contributor Author

@darshankawar maybe this is related. Can we let the ticket open until the hotfix land and see if this resolve the issue

@google-oss-bot google-oss-bot added Needs Attention This issue needs maintainer attention. and removed Stale Issue with no recent activity blocked: customer-response Waiting for customer response, e.g. more information was requested. labels Sep 8, 2023
@darshankawar
Copy link

Ok, will keep it open for now.

@darshankawar darshankawar added blocked: flutter and removed Needs Attention This issue needs maintainer attention. labels Sep 12, 2023
@russellwheatley
Copy link
Member

The hot fix mentioned by @darshankawar has landed in Flutter, @wer-mathurin (in Flutter version >= v3.13.4). Could you try it out and see if it addresses your issue?

@google-oss-bot
Copy link

Hey @wer-mathurin. 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!

@google-oss-bot google-oss-bot added the Stale Issue with no recent activity label Oct 24, 2023
@google-oss-bot
Copy link

Since there haven't been any recent updates here, I am going to close this issue.

@wer-mathurin if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

@darshankawar darshankawar added resolution: no-response Customer did not respond after some time. and removed blocked: customer-response Waiting for customer response, e.g. more information was requested. labels Nov 2, 2023
@firebase firebase locked and limited conversation to collaborators Dec 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
blocked: flutter closed-by-bot resolution: no-response Customer did not respond after some time. Stale Issue with no recent activity triage Issue is currently being triaged. type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants