Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is it possible to upload the flutter source maps or source code to sentry for better debugging?

I would like to have better stacktrace information when I get some error information over sentry. At the moment, flutter sentry only gives you a stacktrace where it appears as "Compiled" code and it makes debugging more difficult.

Is there a way to upload the source maps or the source code to have a more accurate idea when an error comes ?

thank you!

Here an example (It is not really useful) :

Here an example from sentry

like image 721
Alejandro Jaramillo Avatar asked Feb 13 '26 21:02

Alejandro Jaramillo


1 Answers

there is a new flag you can set when building https://github.com/flutter/flutter/issues/72150

 --source-maps

the following script might help you

export SENTRY_RELEASE=$(date +%Y-%m-%d_%H-%M-%S)
export OUTPUT_FOLDER_WEB=./build/web/

flutter build web --dart-define=SENTRY_RELEASE=$SENTRY_RELEASE --source-maps

echo -e "[\033[92mrun\033[0m] Uploading sourcemaps for $SENTRY_RELEASE"
sentry-cli releases new $SENTRY_RELEASE
sentry-cli releases files $SENTRY_RELEASE upload-sourcemaps . \
    --ext dart \
    --rewrite
sentry-cli releases files $SENTRY_RELEASE upload-sourcemaps ${OUTPUT_FOLDER_WEB}main.dart.js.map
sentry-cli releases finalize $SENTRY_RELEASE

Sentry also provides an example without the --source-maps https://github.com/getsentry/sentry-flutter/blob/d22e8376648dd9746304646036dbd24bb885e177/example/run.sh#L24-L29

like image 136
m1416 Avatar answered Feb 15 '26 12:02

m1416



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!