getsentry / sentry-dart

Sentry SDK for Dart and Flutter
https://sentry.io/for/flutter/
MIT License
725 stars 223 forks source link

Unsupported operation: Platform._operatingSystem when compiling to wasm #2082

Open theniceboy opened 3 weeks ago

theniceboy commented 3 weeks ago

Platform

Flutter Web

Obfuscation

Disabled

Debug Info

Enabled

Doctor

[✓] Flutter (Channel master, 3.23.0-13.0.pre.62, on macOS 14.4.1 23E224 darwin-arm64, locale en-US)
    • Flutter version 3.23.0-13.0.pre.62 on channel master at /Users/david/fvm/versions/master
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision df17f36238 (3 hours ago), 2024-05-31 23:13:24 +0200
    • Engine revision fa30658755
    • Dart version 3.5.0 (build 3.5.0-209.0.dev)
    • DevTools version 2.36.0-dev.10

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/david/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/david/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15E204a
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • 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-17.0.9b1087.7-11185874)

[✓] VS Code (version 1.88.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (3 available)
    • macOS (desktop)                 • macos                 • darwin-arm64   • macOS 14.4.1 23E224 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin         • macOS 14.4.1 23E224 darwin-arm64
    • Chrome (web)                    • chrome                • web-javascript • Google Chrome 125.0.6422.141
    ! Error: Browsing on the local area network for wiphone (2). Ensure the device is unlocked and attached with a cable or associated with the same local area
      network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
    ! Error: Browsing on the local area network for ipm. Ensure the device is unlocked and attached with a cable or associated with the same local area network as
      this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Version

8.2.0

Steps to Reproduce

flutter clean && flutter build web --wasm --no-strip-wasm && (cd build/web && dhttpd '--headers=Cross-Origin-Embedder-Policy=credentialless;Cross-Origin-Opener-Policy=same-origin;Cache-Control=no-store,no-cache,must-revalidate,max-age=0')

Expected Result

Compiling to wasm and running

Actual Result

Unsupported operation: Platform._operatingSystem
main.dart.mjs:56     at Error._throwWithCurrentStackTrace (http://localhost:5066/main.dart.wasm:wasm-function[1420]:0x2f5162)
    at Platform.operatingSystem (http://localhost:5066/main.dart.wasm:wasm-function[3200]:0x31f85a)
    at Platform.isWindows (http://localhost:5066/main.dart.wasm:wasm-function[4264]:0x347016)
    at Spotlight (http://localhost:5066/main.dart.wasm:wasm-function[8152]:0x3abef6)
    at SentryFlutter.init inner (http://localhost:5066/main.dart.wasm:wasm-function[43777]:0x7680b7)
    at main inner.1 (http://localhost:5066/main.dart.wasm:wasm-function[9200]:0x3cce3b)
    at _awaitHelperWithTypeCheck closure at org-dartlang-sdk:///dart-sdk/lib/_internal/wasm/lib/async_patch.dart:97:16 (http://localhost:5066/main.dart.wasm:wasm-function[2428]:0x31003e)
    at closure wrapper at org-dartlang-sdk:///dart-sdk/lib/_internal/wasm/lib/async_patch.dart:97:16 trampoline (http://localhost:5066/main.dart.wasm:wasm-function[2434]:0x31013f)

Are you willing to submit a PR?

None

buenaflor commented 3 weeks ago

This is going to be addressed in the PR #2064