I am using sentry on my project. after adding its dependencies I added its configuration on main dart:
void main() {
runZonedGuarded(() async {
await setupSentrySameZone(
"https://d88a433.....ingest.us.sentry.io/4507....");
runApp(
SentryWidget(
child: DefaultAssetBundle(
bundle: SentryAssetBundle(),
child: EasyLocalization(
supportedLocales: LocalizationConst.supportedLocales,
path: LocalizationConst.localesPath,
fallbackLocale: LocalizationConst.defaultLocale,
useOnlyLangCode: true,
assetLoader: const CodegenLoader(),
child: .....,
),
),
);
}, (exception, stackTrace) async {
await Sentry.captureException(exception, stackTrace: stackTrace);
});
and setupSentrySameZone method:
Future<void> setupSentrySameZone(
String dsn, {
bool isIntegrationTest = false,
BeforeSendCallback? beforeSendCallback,
}) async {
await SentryFlutter.init(
(options) {
options.dsn = dsn;
options.tracesSampleRate = 1.0;
options.profilesSampleRate = 1.0;
options.enableAutoSessionTracking = false;
options.reportPackages = false;
options.considerInAppFramesByDefault = false;
options.attachThreads = true;
options.enableWindowMetricBreadcrumbs = true;
options.sendDefaultPii = true;
options.reportSilentFlutterErrors = true;
options.attachScreenshot = true;
options.screenshotQuality = SentryScreenshotQuality.low;
options.attachViewHierarchy = true;
options.debug = true;
options.spotlight = Spotlight(enabled: true);
options.enableTimeToFullDisplayTracing = true;
options.maxRequestBodySize = MaxRequestBodySize.always;
options.maxResponseBodySize = MaxResponseBodySize.always;
if (isIntegrationTest) {
options.dist = '1';
options.environment = 'integration';
options.beforeSend = beforeSendCallback;
}
},
);
}
and also I am using
dev_dependencies:
flutter_test:
sdk: flutter
build_runner: ^2.4.6
sentry_dart_plugin: ^1.0.0
and also I have puspec.yml I added sentry config:
sentry:
upload_debug_symbols: false
upload_source_maps: true
upload_sources: false
project: my_project_name
org: myOrg
auth_token: a9.....87
log_level: error
for CI/CD part I am using firebase so in this is my pipeline part:
- run: flutter pub get
- run: melos run generate:flutter
- run: flutter build web --release --dart-define=dart.vm.product=true --source-maps
# Upload source maps to Sentry
- name: Upload source maps to Sentry
run: flutter pub run sentry_dart_plugin
everything is fine and pipeline works correctly when I am building web release but when I have an issue on sentry issue profile I think the source map not working correctly, this is the issue on the sentry :
2
Answers
I am going to do a wild guess and say it’s because of the minification of the web build: I had a similar issue with Flutter Web (not with Sentry though), where the database column names where altered by the minification included by default in the building script of the web platform. The strange, short syntax using only
a
,b
and so on reminds me exactly of that problem.Try compiling your app by running this on terminal to build the web app
Can you follow the steps here: https://github.com/getsentry/sentry-dart/issues/1679#issuecomment-1828176200 and check back if it works locally?