fix(sentry): sync dist parameter to resolve minified stack traces

This commit is contained in:
dab246
2026-02-24 13:49:03 +07:00
committed by Dat H. Pham
parent 9cc92fbfa8
commit 296548a781
3 changed files with 13 additions and 1 deletions
+3 -1
View File
@@ -20,7 +20,9 @@ ENV GITHUB_SHA=$GITHUB_SHA \
SENTRY_RELEASE=$SENTRY_RELEASE
RUN ./scripts/prebuild.sh && \
flutter build web --release --source-maps --dart-define=SENTRY_RELEASE=$SENTRY_RELEASE && \
flutter build web --release --source-maps \
--dart-define=SENTRY_RELEASE=$SENTRY_RELEASE \
--dart-define=SENTRY_DIST=$GITHUB_SHA && \
if [ -n "$SENTRY_AUTH_TOKEN" ] && [ -n "$SENTRY_ORG" ] && [ -n "$SENTRY_PROJECT" ] && [ -n "$SENTRY_RELEASE" ]; then \
echo "Sentry configuration detected, uploading sourcemaps..." && \
curl -sL https://sentry.io/get-cli/ | SENTRY_CLI_VERSION=2.20.7 bash && \
+9
View File
@@ -32,6 +32,11 @@ class SentryConfig {
// Check if Sentry is available
final bool isAvailable;
// The distribution version of the release.
// In this project, it represents the Git SHA passed via `--dart-define=SENTRY_DIST`.
// This must match the `--dist` parameter used when uploading source maps to Sentry.
final String? dist;
SentryConfig({
required this.dsn,
required this.environment,
@@ -42,6 +47,7 @@ class SentryConfig {
this.isDebug = BuildUtils.isDebugMode,
this.attachScreenshot = false,
this.isAvailable = false,
this.dist,
});
/// Load configuration from an env file.
@@ -62,11 +68,14 @@ class SentryConfig {
final appVersion = await ApplicationManager().getAppVersion();
const sentryDist = String.fromEnvironment('SENTRY_DIST');
return SentryConfig(
dsn: sentryDSN,
environment: sentryEnvironment,
release: appVersion,
isAvailable: isAvailable,
dist: sentryDist.isNotEmpty ? sentryDist : null,
);
}
}
@@ -30,6 +30,7 @@ class SentryInitializer {
options.dsn = config.dsn;
options.environment = config.environment;
options.release = config.release;
options.dist = config.dist;
options.tracesSampleRate = config.tracesSampleRate;
options.profilesSampleRate = config.profilesSampleRate;
options.enableLogs = config.enableLogs;