Skip to content
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

[Sentry] source maps stacktrace #37875

Closed
irux opened this issue Aug 8, 2019 · 4 comments
Closed

[Sentry] source maps stacktrace #37875

irux opened this issue Aug 8, 2019 · 4 comments
Labels
c: new feature Nothing broken; request for a new capability c: proposal A detailed proposal for a change to Flutter p: sentry Error reporting package package flutter/packages repository. See also p: labels.

Comments

@irux
Copy link

irux commented Aug 8, 2019

Hello, I have the following question:
Is it possible to have a better stacktrace in sentry when something crash in my flutter app? Sometimes sentry doesn't give you something useful because the the stacktrace is only flutter internal libraries. Can I have something like source maps in JavaScript? Thank you!

@BondarenkoStas BondarenkoStas added d: stackoverflow Good question for Stack Overflow c: new feature Nothing broken; request for a new capability labels Sep 18, 2019
@VladyslavBondarenko VladyslavBondarenko added the team-infra Owned by Infrastructure team label Jan 16, 2020
@godofredoc godofredoc removed the team-infra Owned by Infrastructure team label Jan 29, 2020
@iapicca iapicca added p: first party p: sentry Error reporting package c: proposal A detailed proposal for a change to Flutter and removed d: stackoverflow Good question for Stack Overflow labels Jan 31, 2020
@iapicca iapicca changed the title [Sentry][question] source maps stacktrace [Sentry] source maps stacktrace Jan 31, 2020
@benoitskipr
Copy link

benoitskipr commented Sep 2, 2020

in flutter_web it's even worse, it's minified :

main.dart.js in Object.c at line 2313:3
main.dart.js in auM.$0 at line 69921:23
main.dart.js in HY.CS at line 43336:29
main.dart.js in HX.Ik at line 43470:5
main.dart.js in aug.$0 at line 43546:29
main.dart.js in fD.Nc at line 41149:9
main.dart.js in fD.eM at line 41155:30
main.dart.js in fD.MW at line 41279:14
main.dart.js in fD.Gd at line 41261:3
main.dart.js in fD.MU at line 41238:3

@bruno-garcia
Copy link
Member

bruno-garcia commented Sep 2, 2020

When I upload the generated sourcemaps, I do see it at least unminified:

image

More specifically, the:

../../../lib/main.dart in $0 at line 138:34

Although far from ideal, points to the correct line of the code.
Definitely has room for improvement but at least tell your where your code broke.

To get it to work I built the Flutter app providing the release name:

export SENTRY_RELEASE=release-name
flutter build web --dart-define=SENTRY_RELEASE=$SENTRY_RELEASE

# Upload source maps
sentry-cli releases new $SENTRY_RELEASE

sentry-cli releases files $SENTRY_RELEASE upload-sourcemaps . \
    --ext dart \
    --rewrite

cd ./build/web/
sentry-cli releases files $SENTRY_RELEASE upload-sourcemaps . \
    --ext map \
    --ext js \
    --rewrite

sentry-cli releases finalize $SENTRY_RELEASE

Make sure the app sends the release to Sentry:

const String _release =
    String.fromEnvironment('SENTRY_RELEASE', defaultValue: 'unknown');

    final event = Event(
        exception: error,
        stackTrace: stackTrace,
        // release is required on Web to match the source maps
        release: _release);
    await _sentry.capture(event: event);

We'll be taking the release through the SDK init once we implement that. Improvements are incoming.

There's a script in the example repo to test release builds.

@bruno-garcia
Copy link
Member

Seems like my last comment has been useful. And since then, the Sentry SDK moved to another org so the issue tracking any progress in this area is tracked now here: getsentry/sentry-dart#417

@github-actions
Copy link

github-actions bot commented Aug 2, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 2, 2021
@flutter-triage-bot flutter-triage-bot bot added the package flutter/packages repository. See also p: labels. label Jul 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: new feature Nothing broken; request for a new capability c: proposal A detailed proposal for a change to Flutter p: sentry Error reporting package package flutter/packages repository. See also p: labels.
Projects
None yet
Development

No branches or pull requests

7 participants