-
-
Notifications
You must be signed in to change notification settings - Fork 239
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
Stack traces from Flutter web app don't deobfuscate function names #1430
Comments
Thanks @blaugold , will test it out. |
Image: JSON event: Uploaded bundle: Bundles are actually here: https://sentry-sdks.sentry.io/settings/projects/sentry-flutter/source-maps/artifact-bundles/13d8dc56-b866-5275-8cb8-618012f1b6d5/ Either the generated source maps changed something or there's a regression in our system, I will check this internally. |
The processing team is looking at this. |
@loewenheim should we close this as done? re getsentry/symbolic#786 |
Actually I meant to post the corrected stacktrace here for feedback, thanks for reminding me :) With the linked symbolic change, we now get this stacktrace for the provided example program:
As you can see, most function names are now resolved, but we don't have source contents for all files. |
@loewenheim is this deployed and live already? If so, @blaugold mind testing once more? Thanks! |
It's not live yet, I'll get it ready ASAP |
Closed this prematurely. The fix is now live. |
Thanks for the swift fix! For synchronous code, I now get the correct function names. 🎉 Unfortunately, it does not solve the issue for async code. 😅 If you change the function that throws the exception to the code below, the throwing frame is reported like this: onPressed: () async {
await Future(() {});
throw Exception('Test exception');
}, Here is an example of how the import 'dart:convert';
import 'dart:io';
import 'package:source_map_stack_trace/source_map_stack_trace.dart';
import 'package:source_maps/source_maps.dart';
const stackTraceString = r'''
minified:GR: Exception: Test exception
at Object.b (main.dart.js:4293:3)
at <fn> (main.dart.js:56371:16)
at a45.a (main.dart.js:5603:62)
at a45.$2 (main.dart.js:31015:14)
at a2X.$1 (main.dart.js:31009:21)
at Object.a3Z (main.dart.js:5858:19)
at Ed.<fn> (main.dart.js:57768:68)
at Gh.jD (main.dart.js:31819:12)
at a0i.$0 (main.dart.js:31350:11)
at Object.p3 (main.dart.js:5729:40)
''';
void main() {
final mapping = SingleMapping.fromJson(jsonDecode(File('build/web/main.dart.js.map').readAsStringSync()));
final stackTrace = StackTrace.fromString(stackTraceString);
final mappedStackTrace = mapStackTrace(mapping, stackTrace, minified: true);
print(mappedStackTrace.toString());
} And this is its output:
|
Running the source map from the example through #[test]
fn dart_debug() {
let minified = std::fs::read_to_string(fixture("sourcemapcache/dart/main.dart.js")).unwrap();
let map = std::fs::read_to_string(fixture("sourcemapcache/dart/main.dart.js.map")).unwrap();
let writer = SourceMapCacheWriter::new(&minified, &map).unwrap();
let mut buf = vec![];
writer.serialize(&mut buf).unwrap();
let cache = SourceMapCache::parse(&buf).unwrap();
let sl = cache.lookup(SourcePosition::new(56371, 16)).unwrap();
println!("{:?}", sl);
}
Would it be a problem to use the mapped |
@loewenheim can you take a look at this use case as well? |
Thanks @blaugold for debugging this with us. |
Continuing from here: #897 (comment)
Platform
Flutter Web
Obfuscation
Disabled
Debug Info
Disabled
Doctor
Flutter 3.7.12 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 4d9e56e694 (3 weeks ago) • 2023-04-17 21:47:46 -0400
Engine • revision 1a65d409c7
Tools • Dart 2.19.6 • DevTools 2.20.1
Version
7.5.1
Steps to Reproduce
flutter create sentry_flutter_web_stacktraces_repro
cd sentry_flutter_web_stacktraces_repro
flutter pub add sentry_flutter
flutter pub add dev:sentry_dart_plugin
Configure sentry_dart_plugin:
Replace
lib/main.dart
with the following:Configure DSN in
main.dart
flutter build web --source-maps
dart run sentry_dart_plugin
cd build/web
Start a web server to serve the files, e.g.
caddy file-server
Open the web app in a browser, wherever it is served, e.g.
http://localhost
.Click on the "Throw exception" button
Expected Result
The stack trace for error events sent to sentry should contain deobfuscated funtion names.
Actual Result
While the correct line and column numbers have been recovered, function names are not deobufscated:
Link to an example event: https://gabriel-59.sentry.io/issues/4170223115/events/234cd5801ab546e3a8812316462ebda4/?project=4505149812834304
Are you willing to submit a PR?
None
The text was updated successfully, but these errors were encountered: