-
-
Notifications
You must be signed in to change notification settings - Fork 237
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
Zone missmatch on flutter web #1943
Comments
I also tried to wrap everythin inside main() with a I think the problen is that The appRunner is initialized with a runZoneGuarded automatically on Web. There is no option to disable this ro run my own guarded zone on the web. I cannot init my data inside the app runner because i need to give the user the option to diable Sentry (mandatory from my companys legal team). If there is a workaround by disabling Sentry programatically on another way, i'd be happy to use this. |
Same here, all combinations result in that mismatch |
hi @kay4ik and @r-dev-limited
This means that
|
As a workaround, you could use the
|
No this is not working. The Zone missmatch occurs either way. Thank you for the workaround idea! I will try it :) |
So the workaround is working fine but i think it should be possible to initialize the app before sentry. |
Let's add the workaround to the troubleshooting section of the docs. |
I run into the same issue but for me it is not user consent that I run before |
do errors etc.. still log to sentry despite the zone mismatch error? |
The problem is that we always run |
Should be possible by checking if |
FWIW, Zone creation is skipped when no appRunner callback is passed. So, as of now, you should not use the appRunner callback when creating the zone yourself. If you do not create the zone yourself, you should use the appRunner callback. (On io platform zones and the appRunner callback are not needed) |
@ueman oh yeah, was there a specific reason why it was implement this way? (creating zone if appRunner callback is used otherwise skip) |
No clue, since that's code from before I started contributing. But it's somewhat logical to do it that way since Sentry can only create a zone for you if Sentry is executing the appRunner callback. If the callback is not used, creating a zone doesn't actually do anything. You need to be aware of this even if there would be an option for creating a zone. So adding an option would probably lead to just as much confusion, since you're still required to use the appRunner callback correctly. |
Totally agree. I was confused, too 😅 |
Thoughts on skipping zone creation on web if the current zone != root zone in Or shall we rather keep it as it is and tell users to just not use the appRunner callback in case they want to have a guarded zone themselves? |
i think it still makes sense, to make the SDK simpler to use |
Thinking more about it, if we don't create a zone, the user will be responsible to manually add
In both cases we should improve docs. |
it's possible to decorate the user's onError callback with ours on top of it - so it would be possible to keep the default behaviour (reporting the error to Sentry) on top of the user's custom onError. Just need to add proper docs in that case that the user shouldn't report that exception again otherwise it would be sent twice |
Another problem with internal Sentry's call to On a side note. When code in the |
@ekuleshov
We are going to make it work even when passing the |
@stefanosiano, thx its work for me. |
As a (potential) customer, I'd encourage someone to consider the DX while this issue is prioritised. In spite of the onboarding flow I did find my way here today. On a day with worse google-fu, I may have just binned this off and used something/body else ;) That said, it's certainly a positive to find #1943 (comment) and unblock my eval :) |
@ewann that's fair feedback, thanks 👍 |
@ewann thx for the feedback, I agree this needs to addressed. I'll have a look here and see how we can improve the dx |
Platform
Flutter Web
Obfuscation
Disabled
Debug Info
Disabled
Doctor
[√] Flutter (Channel stable, 3.19.3, on Microsoft Windows [Version 10.0.19045.4046], locale de-DE)
• Flutter version 3.19.3 on channel stable at C:\Users\R081094\dev\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision ba39319843 (13 days ago), 2024-03-07 15:22:21 -0600
• Engine revision 2e4ba9c6fb
• Dart version 3.3.1
• DevTools version 2.31.1
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at C:\Users\R081094\AppData\Local\Android\Sdk
• Platform android-34, build-tools 34.0.0
• ANDROID_HOME = C:\Users\R081094\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 17.0.9+0--11185874)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.9.3)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.9.34701.34
• Windows 10 SDK version 10.0.20348.0
[√] Android Studio (version 2023.2)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.9+0--11185874)
[√] VS Code (version 1.87.2)
• VS Code at C:\Users\R081094\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.84.0
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19045.4046]
• Chrome (web) • chrome • web-javascript • Google Chrome 122.0.6261.129
• Edge (web) • edge • web-javascript • Microsoft Edge 122.0.2365.92
[√] Network resources
• All expected network resources are available.
• No issues found!
Version
7.18.0
Steps to Reproduce
Future<void> init()
method wich is called inmain()
and initializes some stuff asynch.main()
should look like this:Expected Result
I expected that the app starts normally without throwing an exception.
Actual Result
Following Exception is thrown:
Are you willing to submit a PR?
No
The text was updated successfully, but these errors were encountered: