-
-
Notifications
You must be signed in to change notification settings - Fork 223
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
Flutter bindings zoneMismatch error when running on web target #2063
Comments
This is caused by the WidgetsBinding being initialized in a different zones than where You could also not use the appRunner callback, which would fix the zone mismatch, but it would cause exception in the root zone to not be reported |
If that is the case, why this error is only happening on web only? It seems like Sentry init method does too many things at once (its own init, zone creation, exception handling, etc), including things not asked for, such as widget bindings. It also hijacks the default exception handler and does not leave an option to customize your own, e.g. log exception and stack traces to console when debugging in ide. |
IO platform don't need the zone, only web needs it. On IO platforms, the platform dispatcher onError callback does what the zone does on web. Sentry does allow you to override exception handlers though, you just have to set them before initializing sentry. If you do it afterwards, you'll obviously override Sentry's settings. But then again, Sentry's purpose kinda is to set those exception handlers. Initializing the WidgetsBinding is also needed because otherwise Sentry can't do platform communication to set settings native to the platform. It does a lot because you need to do a lot to catch all errors. (I'm no Sentry employee btw) |
I see, though it is hidden "magic" and things could have been more explicit, or at least documented in the
I thought Sentry's purpose it to provide a service to track those exceptions and other stuff... 😀 PS: I'm coming from Crashlytics experience where things are left to a developer to configure explicitly where framework simply provided API to report the errors without trying to do everything for you. |
@ekuleshov we'll consider your input 👍 (cc @buenaflor). Are your questions answered? Btw. thanks @ueman for chiming in 🙏 |
I'm having the same problem. I have tried to remove the |
@aprizzo just tested an example with your code snippet and even after removing I don't think removing |
hi @aprizzo
Basically the second parameter of |
@stefanosiano does Also, when the |
hi @ekuleshov |
Platform
Flutter Web
Obfuscation
Disabled
Debug Info
Disabled
Doctor
[✓] Flutter (Channel stable, 3.22.0, on macOS 13.6.6 22G630 darwin-arm64, locale en-CA)
• Flutter version 3.22.0 on channel stable at ***
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 5dcb86f68f (10 days ago), 2024-05-09 07:39:20 -0500
• Engine revision f6344b75dc
• Dart version 3.4.0
• DevTools version 2.34.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] IntelliJ IDEA Ultimate Edition (version 2024.1.1)
• IntelliJ at /Applications/IntelliJ IDEA.app
• Flutter plugin version 79.1.3
• Dart plugin version 241.15989.9
[✓] Connected device (3 available)
• macOS (desktop) • macos • darwin-arm64 • macOS 13.6.6 22G630 darwin-arm64
• Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 13.6.6 22G630 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 124.0.6367.209
[✓] Network resources
• All expected network resources are available.
Version
8.2.0
Steps to Reproduce
Launch a Flutter app with Sentry initialized on the web target.
The main method of the app roughly look like this:
Expected Result
The
Sentry.init()
should not cause issue with Flutter bindings in the web target platform.Actual Result
The following error/warning is shown when app is started on the web target.
When running on Android, iOS or MacOS target no such warning is shown.
Are you willing to submit a PR?
No
The text was updated successfully, but these errors were encountered: