getsentry / sentry-dart-plugin

A Dart Build Plugin that uploads debug symbols for Android, iOS/macOS and source maps for Web to Sentry via sentry-cli
MIT License
66 stars 29 forks source link

Source Maps does not works with Flutter Web #38

Closed ghost closed 2 years ago

ghost commented 2 years ago

Environment

Flutter SDK version

"flutterSdkVersion": "3.0.5"

sentry_dart_plugin version:

sentry_dart_plugin: ^1.0.0-beta.1

stdout: > Found 3631 release files
> Analyzing 3631 sources
> Rewriting sources
> Adding source map references
> Bundled 3631 files for upload
> Uploaded release files to Sentry
> File upload complete (processing pending on server)
> Organization: novade
> Project: novade
> Release: novade_lite@1.7.0+63
> Dist: 63

Steps to Reproduce

  1. Build the project for web.
  2. Setup pubspec config as following
    
    sentry:
    upload_source_maps: true

3. Run `flutter flutter packages pub run sentry_dart_plugin`

### Expected Result

We were using sentry-cli to upload source map previously and it also didn't work. We were asked to try this new plugin and seem it also doesn't work.

<img width="1073" alt="Screenshot 2022-08-29 at 3 41 22 PM" src="https://user-images.githubusercontent.com/107825037/187178842-e08344a9-c18b-4cb0-af8c-25e992643cb9.png">

### Actual Result

Source maps should setup correctly. 
marandaneto commented 2 years ago

@chathu-novade The screenshot is about the source maps of the Dart SDK itself and not your App's code. Do you see your App's code symbolicated? that should work OOTB.

ghost commented 2 years ago

This is what the stack looks like. Can not see the anything related to app code.

Screenshot 2022-08-30 at 1 16 48 PM
ghost commented 2 years ago

The hidden source section of the screenshot looks like the following.


source: https://domain.tld/hostedtoolcache/Flutter/3.0.5/macos/flutter/.pub-cache/hosted/pub.dartlang.org/sentry-6.9.1/lib/src/sentry_client.dart
marandaneto commented 2 years ago

I don't follow, the screenshot below has the symbolicated stack trace, it's not minified, what's the problem you are having? can you please update the issue description with more details?

ghost commented 2 years ago

@marandaneto I can not see any stack trace related my my dart code in the flutter project. It show only minified:e4b and exception but not the line of dart code.

marandaneto commented 2 years ago

@chathu-novade can you provide the code snippet of the Sentry SDK init? Can you provide the full config of the sentry plugin? Can you provide the command line you are using to build your Flutter app? Can you provide a link to an issue on sentry.io so I can have a look?

ghost commented 2 years ago

Sentry SDK init

 await SentryFlutter.init(
      (options) {
        options
          ..environment = env.toStr()
          ..release = sentryRelease // from String.fromEnvironment('SENTRY_RELEASE')
          ..dsn = dsn;
      },
      // Init your App.
      appRunner: () => runApp(const _App()),
    );

Sentry plugin config

sentry:
  upload_source_maps: true

Flutter build command

flutter build web --dart-define=SENTRY_RELEASE=$(SENTRY_RELEASE) --dart-define=AMPLITUDE_API_KEY=$(AMPLITUDE_API_KEY) -t lib/web/main.staging.dart --web-renderer canvaskit --source-maps --dart-define=BROWSER_IMAGE_DECODING_ENABLED=false
marandaneto commented 2 years ago

@chathu-novade release and dist should match when initing the SDK and uploading source maps. I see that you don't set the dist at least, do they match? Can you provide a link to an Sentry's issue?

marandaneto commented 2 years ago

@chathu-novade you probably need --release in your build command line as well.

ghost commented 2 years ago

dist is default so it get build in build/web which also the default of this plugin.

ghost commented 2 years ago

@marandaneto

https:
//sentry.io/organizations/novade/issues/
3543519896/
?project=1770595
ghost commented 2 years ago

The flutter mobile builds works well Issue is with the web build

marandaneto commented 2 years ago

@chathu-novade I don't see any problem with your errors, its symbolicated correctly. The issue title is minified:e2b because of https://docs.sentry.io/platforms/flutter/troubleshooting/#known-limitations See runtimeType. You are likely calling captureException with an object that is not an exception and its stringified, so there's no problem with symbolication. Can you clarify the problem?

ghost commented 2 years ago

@chathu-novade you probably need --release in your build command line as well.

--release Build a release version of your app (default mode).

ghost commented 2 years ago

@marandaneto In that error there are errors which says source code not found.

Screenshot 2022-08-30 at 8 00 48 PM
marandaneto commented 2 years ago

@chathu-novade that's already answered here https://github.com/getsentry/sentry-dart-plugin/issues/38#issuecomment-1231230647 If you don't see any frame from your own App, the reason is here https://github.com/getsentry/sentry-dart-plugin/issues/38#issuecomment-1231659696 So I guess that's all from my side unless you provide more context around my questions.

ghost commented 2 years ago

About

The issue title is minified:e2b because of https://docs.sentry.io/platforms/flutter/troubleshooting/#known-limitations See runtimeType.

Does this applicable to the web too?

web Obfuscation is not supported for web apps, but a web app can be minified, which is similar. When you build a release version of a Flutter web app, it is automatically minified. For more information, see Build and release a web app.

marandaneto commented 2 years ago

Please raise an issue on https://github.com/getsentry/sentry-dart and provide a minimal reproducible example (this is required), it's unclear what's the problem here since the linked event just works, without more context, we can't help.

ghost commented 2 years ago
https 
://sentry.io/organizations/novade/issues/ 
3510915187/events/ 
bcaba367a7e74e92b0f7258900827d9a/

Check this issue and expand the stackstrace. We can not see which file threw the exception and not usable stack trace.