Repository navigation
fix(cli): Send the Flutter wizard's sample error only in debug builds - #2828
Merged
Merged
Conversation
Found by testing `sentry wizard flutter` on a fresh `flutter create` app (Flutter 3.44.1). All four also exist in `@sentry/wizard` 9.1.0. - Wrap the sample exception in `if (kDebugMode)`, so shipped apps no longer send it on every launch. `material.dart` does not export `kDebugMode`, so `main.dart` gets `package:flutter/foundation.dart` unless it already imports it. - Write `ignore_missing: true`, so `sentry_dart_plugin` does not exit 1 after uploading when the previous release's commit is not in the local history, such as in a shallow CI clone. - Write `upload_source_maps: true` only when the project has a `web/` folder. - Suggest a build command that saves the Dart obfuscation map, and write `dart_symbol_map_path` so the plugin uploads it. Co-Authored-By: Antonis Lilis <antonis.lilis@sentry.io>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
antonis
marked this pull request as ready for review
December 3, 2026 08:43
antonis
approved these changes
Dec 3, 2026
This was referenced Dec 3, 2026
14 of 16 tasks
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These four issues come from testing
sentry wizard flutteron a freshflutter createapp (Flutter 3.44.1). All four also exist in@sentry/wizard9.1.0.1. The sample exception was sent on every launch, Release included.
initSnippetnow wraps it inif (kDebugMode) { … }, with the comment "Sends a sample error in debug builds. Remove these lines after confirming that your Sentry integration is working.", the same way the iOS (#2798) and Android (#2803) wizards now handle their test events. The defaultmain.dartonly importspackage:flutter/material.dart, which doesn't makekDebugModevisible:widgets.dartre-exports onlyBrightnessandUniqueKeyfromfoundation.dart, andflutter analyzereportsUndefined name 'kDebugMode'without the import. SopatchMainContentaddsimport 'package:flutter/foundation.dart';next to the Sentry import, unless the file already has an unprefixed import of it (with noshowlist, or one that includeskDebugMode). Existing import handling is unchanged. The outro now says the test error triggers when the app starts in debug mode.2.
sentry_dart_pluginexited 1 after a successful upload. Its commits step defaults toauto, so when the previous release's commit isn't in the local history (for example a shallow CI clone)set-commitsfails with "Could not find the SHA of the previous release in the git history", and the whole command fails even though the debug symbols uploaded. Thesentry:block now setsignore_missing: true, with a comment. The plugin passes it tosentry-cli releases set-commits --ignore-missing, and that is the only place it's used.3.
upload_source_maps: truewas written for mobile apps. It only matters for Flutter web; on mobile the plugin just logs "Skipping source maps upload".patchPubspecnow writes it only when there's aweb/folder next topubspec.yaml, and passes that topubspecOptions. The copy-pastepubspec.yamlsnippet uses the same check.4. No Dart obfuscation map. The suggested build command now adds
--extra-gen-snapshot-options=--save-obfuscation-map=build/app/obfuscation.map.json, and thesentry:block setsdart_symbol_map_path: build/app/obfuscation.map.json, so the plugin uploads the map and obfuscated names in exception messages and type names become readable. In the plugin,dart_symbol_map_pathhas to point at the file itself, not a directory. When the file is missing, the plugin logs "Skipping Dart symbol map uploads" and doesn't fail (lib/src/symbol_maps/dart_symbol_map.dart,lib/src/utils/path.dart). The plugin supports this upload on Android and iOS.flutter pub run sentry_dart_pluginstays as it is, becausedart runfailed in testing when a standalone Dart SDK came first on the PATH.Open decision: this stays a draft until Antonis Lilis marks it ready for review.
via Antonis Lilis.
--
View Session [Sentry]