Skip to content

Commit a340cff

Browse files
committed
fix(sentry): sync dist parameter to resolve minified stack traces
1 parent 1c66dab commit a340cff

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ ENV GITHUB_SHA=$GITHUB_SHA \
2020
SENTRY_RELEASE=$SENTRY_RELEASE
2121

2222
RUN ./scripts/prebuild.sh && \
23-
flutter build web --release --source-maps --dart-define=SENTRY_RELEASE=$SENTRY_RELEASE && \
23+
flutter build web --release --source-maps \
24+
--dart-define=SENTRY_RELEASE=$SENTRY_RELEASE \
25+
--dart-define=SENTRY_DIST=$GITHUB_SHA && \
2426
if [ -n "$SENTRY_AUTH_TOKEN" ] && [ -n "$SENTRY_ORG" ] && [ -n "$SENTRY_PROJECT" ] && [ -n "$SENTRY_RELEASE" ]; then \
2527
echo "Sentry configuration detected, uploading sourcemaps..." && \
2628
curl -sL https://sentry.io/get-cli/ | SENTRY_CLI_VERSION=2.20.7 bash && \

core/lib/utils/sentry/sentry_config.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ class SentryConfig {
3232
// Check if Sentry is available
3333
final bool isAvailable;
3434

35+
// The distribution version of the release.
36+
// In this project, it represents the Git SHA passed via `--dart-define=SENTRY_DIST`.
37+
// This must match the `--dist` parameter used when uploading source maps to Sentry.
38+
final String? dist;
39+
3540
SentryConfig({
3641
required this.dsn,
3742
required this.environment,
@@ -42,6 +47,7 @@ class SentryConfig {
4247
this.isDebug = BuildUtils.isDebugMode,
4348
this.attachScreenshot = false,
4449
this.isAvailable = false,
50+
this.dist,
4551
});
4652

4753
/// Load configuration from an env file.
@@ -62,11 +68,14 @@ class SentryConfig {
6268

6369
final appVersion = await ApplicationManager().getAppVersion();
6470

71+
const sentryDist = String.fromEnvironment('SENTRY_DIST');
72+
6573
return SentryConfig(
6674
dsn: sentryDSN,
6775
environment: sentryEnvironment,
6876
release: appVersion,
6977
isAvailable: isAvailable,
78+
dist: sentryDist.isNotEmpty ? sentryDist : null,
7079
);
7180
}
7281
}

core/lib/utils/sentry/sentry_initializer.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class SentryInitializer {
3030
options.dsn = config.dsn;
3131
options.environment = config.environment;
3232
options.release = config.release;
33+
options.dist = config.dist;
3334
options.tracesSampleRate = config.tracesSampleRate;
3435
options.profilesSampleRate = config.profilesSampleRate;
3536
options.enableLogs = config.enableLogs;

0 commit comments

Comments
 (0)