sentry-dart icon indicating copy to clipboard operation
sentry-dart copied to clipboard

Support Flutter Web WASM symbolication

Open marandaneto opened this issue 2 years ago • 16 comments

Description

~JS package -> https://github.com/getsentry/sentry-javascript/tree/develop/packages/wasm~ ~The SDK needs to fill the debug_meta property with the image list.~ ~Flutter Web probably exposes the WebAssembly.Module as well, if not, we can leverage that by using the JS SDK directly.~ ~The Dart plugin should upload the DWARF files.~

~SDKs cannot depend on html packages nor its transitive dependencies~ ~https://docs.flutter.dev/platform-integration/web/wasm#requires-preview-js-interop-to-access-browser-and-js-apis~

~Sentry Flutter SDK isn't compatible as of now.~ ~Sentry Dart SDK compiles just fine.~

~Blocked by https://github.com/flutter/flutter/issues/127564 as well~

Update by @buenaflor:

We are going to utilise sourcemaps generated like so flutter web --wasm --source-maps

~However the current generated sourcemaps by dart2wasm don't contain function names.~

~Currently blocked by: https://github.com/dart-lang/sdk/issues/56718~

This dart2wasm issue is now done and fully supports sourcemaps generation starting from dart 3.7.0-41.0.dev

marandaneto avatar May 25 '23 08:05 marandaneto

Dart SDK compiles but it does not work either. We have to guard every call that depends on dart.library.html or dart.library.io to a no-op call. we do this most of the time but there are probably a few exceptions not considered because we always assume it's either one or the other.

Screenshot 2023-05-25 at 10 41 52

marandaneto avatar May 25 '23 08:05 marandaneto

runtime parsing can also be improved, currently (dart2wasm used in tests and introduced in #2113) we get this:

{
  event_id: dd5764b21ef04faa84c5c9c4a4e54447,
  timestamp: 2024-06-20T17: 43: 53.646Z,
  platform: other,
  user: {
    ip_address: {
      {
        auto
      }
    }
  },
  sdk: {
    name: sentry.dart.browser,
    version: 8.3.0,
    packages: [
      {
        name: pub: sentry,
        version: 8.3.0
      }
    ]
  },
  exception: {
    values: [
      {
        type: _Exception,
        value: Exception,
        stacktrace: {
          frames: [
            {
              filename: unparsed,
              function: at_rootRunUnarytear-offtrampoline(http: //localhost: 60835/MHrTmoJ7AVBxEfI0R9zMcjvHD1kUs8gC/test/sentry_client_test.dart.browser_test.dart.wasm: wasm-function[
                6756
              ]: 0xd9fef),
              abs_path: http: //localhost: 60835/unparsed,
              in_app: true
            },
            {
              filename: unparsed,
              function: at_rootRunUnary(http: //localhost: 60835/MHrTmoJ7AVBxEfI0R9zMcjvHD1kUs8gC/test/sentry_client_test.dart.browser_test.dart.wasm: wasm-function[
                2929
              ]: 0x86136),
              abs_path: http: //localhost: 60835/unparsed,
              in_app: true
            },
            {
              filename: unparsed,
              function: atclosurewrapperatfile: ///Users/ivan/dev/tools/flutter/bin/cache/dart-sdk/lib/_internal/wasm/lib/async_patch.dart: 83: 16trampoline(http: //localhost: 60835/MHrTmoJ7AVBxEfI0R9zMcjvHD1kUs8gC/test/sentry_client_test.dart.browser_test.dart.wasm: wasm-function[
                5634
              ]: 0xc3c13),
              abs_path: http: //localhost: 60835/unparsed,
              in_app: true
            },
            {
              filename: unparsed,
              function: at_awaitHelperclosureatfile: ///Users/ivan/dev/tools/flutter/bin/cache/dart-sdk/lib/_internal/wasm/lib/async_patch.dart: 83: 16(http: //localhost: 60835/MHrTmoJ7AVBxEfI0R9zMcjvHD1kUs8gC/test/sentry_client_test.dart.browser_test.dart.wasm: wasm-function[
                5628
              ]: 0xc3b39),
              abs_path: http: //localhost: 60835/unparsed,
              in_app: true
            },
            {
              filename: unparsed,
              function: atDeclarer.testclosureatfile: ///Users/ivan/.pub-cache/hosted/pub.dev/test_api-0.7.2/lib/src/backend/declarer.dart: 213: 22inner(http: //localhost: 60835/MHrTmoJ7AVBxEfI0R9zMcjvHD1kUs8gC/test/sentry_client_test.dart.browser_test.dart.wasm: wasm-function[
                6573
              ]: 0xd758e),
              abs_path: http: //localhost: 60835/unparsed,
              in_app: true
            },
            {
              filename: unparsed,
              function: atclosurewrapperatfile: ///Users/ivan/dev/sentry-dart/dart/test/sentry_client_test.dart: 121: 7trampoline(http: //localhost: 60835/MHrTmoJ7AVBxEfI0R9zMcjvHD1kUs8gC/test/sentry_client_test.dart.browser_test.dart.wasm: wasm-function[
                1146
              ]: 0x5bdf9),
              abs_path: http: //localhost: 60835/unparsed,
              in_app: true
            },
            {
              filename: unparsed,
              function: atmainclosureatfile: ///Users/ivan/dev/sentry-dart/dart/test/sentry_client_test.dart: 121: 7(http: //localhost: 60835/MHrTmoJ7AVBxEfI0R9zMcjvHD1kUs8gC/test/sentry_client_test.dart.browser_test.dart.wasm: wasm-function[
                942
              ]: 0x58b01),
              abs_path: http: //localhost: 60835/unparsed,
              in_app: true
            }
          ]
        }
      }
    ]
  }
}

vaind avatar Jun 20 '24 17:06 vaind