A Dart Build Plugin that uploads debug symbols for Android, iOS/macOS and source maps for Web to Sentry via sentry-cli

Last update: Jun 6, 2022

Sentry Dart Plugin

Sentry Dart Plugin pub package pub points

A Dart Build Plugin that uploads debug symbols for Android, iOS/macOS and source maps for Web to Sentry via sentry-cli.

For doing it manually, please follow our docs.

πŸ“‹ Install

In your pubspec.yaml, add sentry_dart_plugin as a new dev dependency.

dev_dependencies:
  sentry_dart_plugin: ^1.0.0-beta.1

Build App

The flutter build apk, flutter build ios (or macos) or flutter build web is required before executing the sentry_dart_plugin plugin, because the build spits out the debug symbols and source maps.

Run

Dart

dart run sentry_dart_plugin

Flutter

flutter packages pub run sentry_dart_plugin

Configuration (Optional)

This tool comes with a default configuration. You can configure it to suit your needs.

Add sentry: configuration at the end of your pubspec.yaml file:

sentry:
  upload_native_symbols: true
  upload_source_maps: false
  include_native_sources: false
  project: ...
  org: ...
  auth_token: ...
  url: ...
  wait_for_processing: false
  log_level: error # possible values: trace, debug, info, warn, error
  release: ...
  web_build_path: ...
Available Configuration Fields:
Configuration Name Description Default Value And Type Required Alternative Environment variable
upload_native_symbols Enables or disables the automatic upload of debug symbols true (boolean) no -
upload_source_maps Enables or disables the automatic upload of source maps false (boolean) no -
include_native_sources Does or doesn't include the source code of native code false (boolean) no -
project Project's name e.g. sentry-flutter (string) yes SENTRY_PROJECT
org Organization's slug e.g. sentry-sdks (string) yes SENTRY_ORG
auth_token Auth Token e.g. 64 random characteres (string) yes SENTRY_AUTH_TOKEN
url URL e.g. https://mysentry.invalid/ (string) no SENTRY_URL
wait_for_processing Wait for server-side processing of uploaded files false (boolean) no -
log_level Configures the log level for sentry-cli warn (string) no SENTRY_LOG_LEVEL
release The release version for source maps, it should match the release set by the SDK default: [email protected] from pubspec (string) no -
web_build_path The web build folder default: build/web (string) no -

Troubleshooting

Sentry's auth_token requires the project:releases or project:write scope, See docs.

Dart's --obfuscate option is required to be paired with --split-debug-info to generate a symbol map, See docs.

The --split-debug-info option requires setting a output directory, the directory must be an inner folder of the project's folder, See docs.

The --split-debug-info and --obfuscate are not supported for iOS and Desktop Apps yet, See docs

GitHub

https://github.com/getsentry/sentry-dart-plugin
Comments
  • 1. "pub finished with exit code 1" (and no error message)

    We use sentry.io and the latest Flutter SDK. We're trying to get stack traces working on Android and it has been extremely difficult to get clarity on that process. We found this plugin and are still a bit confused how to use it.

    If we have autoUpload = true in our build.gradle do we still need to run flutter packages pub run sentry_dart_plugin after we build? The comment here - https://docs.sentry.io/platforms/android/proguard/ - makes it seem like we wouldn't but then this plugin's README says that this command flutter packages pub run sentry_dart_plugin is a replacement for the sentry-cli manual stuff, NOT that autoupload setting. It would be good to clarify.

    Also when running flutter packages pub run sentry_dart_plugin we get no error messages, just warnings, but we do get an exit code of 1 which idiomatically means error - "pub finished with exit code 1" ...so confused about that as well

    Reviewed by tamoyal at 2021-09-29 15:12
  • 2. Debug Information Files

    1. configure sentry_dart_plugin liberia
      • I have configured my pub with the examples

    I have sentry-cli installed

    USE:
    
        ..sentry-cli.exe [OPTIONS] <SUBCOMMAND>
    
    OPTIONS:
            --api-key <API_KEY> The provided Sentry API key.
            --auth-token <AUTH_TOKEN> Use the supplied Sentry authentication token.
        -h, --help Print help information
            --header <KEY:VALUE> Custom headers to be attached to all requests
                                         in key:value format.
            --log-level <LOG_LEVEL> Sets the verbosity level of log output. [possible values: trace, debug,
                                         information, warning, error]
            --quiet Do not print any output while keeping the correct exit code.
                                         This flag is currently implemented only for selected
                                         subcommands. [alias: silent]
            --url <URL> Full URL for the Sentry server.
                                         [default: https://sentry.io/]
        -V, --version Print version information
    

    and I get these errors, and I don't know how to fix it

    [❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚] 0% reading config values..
    sentry-cli is not available under the assets folder, using pre-installed sentry-cli
    β˜‘ reading config values
    [❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚] 9% validating config values..
    sentry-cli is not available, please follow https://docs.sentry.io/product/cli/installation/
    ProcessException: El sistema no puede encontrar el archivo especificado.
    
    Reviewed by miguelflores1993 at 2022-05-23 15:38
  • 3. Changing `log_level` causes premature exit

    Environment

    Sentry SaaS with sentry_dart_plugin 1.0.0-beta.1.

    Steps to Reproduce

    1. Set log_level to debug in pubspec.yaml.
    sentry:
      auth_token: XXX
      log_level: debug # Uploading source maps will fail if this is lower than warn.
      org: my-org
      project: my-project
      upload_native_symbols: false
      upload_source_maps: true
    
    1. Run flutter packages pub run sentry_dart_plugin.

    Expected Result

    Source maps are uploaded.

    Actual Result

    After creating the release, the CLI exits prematurely because debug statements like this are written to STDERR:

    stdout: Created release [email protected]+1.
    
    
    stderr:   DEBUG   2022-03-23 22:59:35.150167 -07:00 sentry-cli version: 1.69.1, platform: "darwin", architecture: "x86_64"
      INFO    2022-03-23 22:59:35.150718 -07:00 sentry-cli was invoked with the following command line: "/Users/vsomayaji/Dev/flutter/.pub-cache/hosted/pub.dartlang.org/sentry_dart_plugin-1.0.0-beta.1/lib/assets/sentry-cli-Darwin-x86_64" "--auth-token" "XXX" "--log-level" "trace" "releases" "--org" "my-org" "--project" "my-project" "new" "[email protected]+1"
      DEBUG   2022-03-23 22:59:35.150953 -07:00 request POST https://sentry.io/api/0/projects/my-org/my-project/releases/
      DEBUG   2022-03-23 22:59:35.150972 -07:00 using token authentication
    

    This appears to be because this code exits whenever STDERR is not empty:

    https://github.com/getsentry/sentry-dart-plugin/blob/347089e40c4271410e0bf78c5567a7fcd5430572/lib/src/utils/log.dart#L111-L113

    Reviewed by vsomayaji at 2022-03-24 15:40
  • 4. Add `url` as configurable parameter

    :scroll: Description

    Added url as configurable parameter

    :bulb: Motivation and Context

    To use this plugin with on-premise Sentry servers

    :green_heart: How did you test it?

    With our own on-premise Sentry server!

    :pencil: Checklist

    • [x] I reviewed submitted code
    • [ ] I added tests to verify changes
    • [x] I updated the docs if needed
    • [ ] All tests passing
    • [x] No breaking changes
    Reviewed by Amir-P at 2021-11-02 14:57
  • 5. Add license scan report and status

    Your FOSSA integration was successful! Attached in this PR is a badge and license report to track scan status in your README.

    Below are docs for integrating FOSSA license checks into your CI:

    Reviewed by fossabot at 2022-04-27 02:00
  • 6. What are the correct upload settings and inclusion settings to use?

    Thanks for your work on this great plugin!

    The docs list these options:

      upload_native_symbols: true
      upload_source_maps: false
      include_native_sources: false
    

    It's not clear to us which of these options to use.

    We build apps for both mobile and web in one go (with --source-maps enabled on the web release) and then run flutter packages pub run sentry_dart_plugin, so I presume we want to enable all three options? Is there a reason why we wouldn't want to enable one of these options?

    I think it'd be really nice to document what to do here. πŸ™

    Reviewed by stx at 2022-04-09 22:01
  • 7. [Flutter Web] I don't know where else to ask -- am I missing something here?

    flutter pub run sentry_dart_plugin

    [❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚] 0% reading config values..
    sentry-cli is not available under the assets folder, using pre-installed sentry-cli
    β˜‘ reading config values
    [❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚] 9% validating config values..
    Auth Token is empty, check 'auth_token' at pubspec.yaml or SENTRY_AUTH_TOKEN env. var.
    pub finished with exit code 1
    

    Is there a way for me to 'login' at this pre-installed sentry-cli so I don't have to pass any configuration options?

    I've installed sentry-cli via npm i -g @sentry/cli, but sentry_dart_plugin doesn't use that.

    I'm on Windows 10 btw.

    Thanks!

    Reviewed by IvanDeluxe at 2021-12-24 11:17
  • 8. Fix: Log real exitCode, stdout and stdout if available

    :scroll: Description

    Fix: Log real exitCode, stdout and stdout if available

    :bulb: Motivation and Context

    poor exit code and log message https://github.com/getsentry/sentry-dart-plugin/issues/7

    :green_heart: How did you test it?

    :pencil: Checklist

    • [X] I reviewed submitted code
    • [ ] I added tests to verify changes
    • [ ] I updated the docs if needed
    • [X] All tests passing
    • [X] No breaking changes

    :crystal_ball: Next steps

    Reviewed by marandaneto at 2021-10-12 07:34
  • 9. Do conditional imports for `dart:io` classes

    so we can get the last 10 pub points https://pub.dev/packages/sentry_dart_plugin/score it's not a blocker though since the tooling is only meant to run on native environments and not web, but you could technically run the transpiled program

    Reviewed by marandaneto at 2021-08-27 07:56
  • 10. Fix: Early exit when providing lower log level

    • Fix early exit when providing lower log level
    • changelog

    :scroll: Description

    :bulb: Motivation and Context

    Closes https://github.com/getsentry/sentry-dart-plugin/issues/30

    :green_heart: How did you test it?

    :pencil: Checklist

    • [X] I reviewed submitted code
    • [ ] I added tests to verify changes
    • [ ] I updated the docs if needed
    • [X] All tests passing
    • [X] No breaking changes

    :crystal_ball: Next steps

    Reviewed by marandaneto at 2022-03-26 08:01
  • 11. Remove dev channel

    :scroll: Description

    #skip-changelog

    :bulb: Motivation and Context

    Similar to https://github.com/getsentry/sentry-dart/pull/672

    :green_heart: How did you test it?

    :pencil: Checklist

    • [ ] I reviewed submitted code
    • [ ] I added tests to verify changes
    • [ ] I updated the docs if needed
    • [ ] All tests passing
    • [ ] No breaking changes

    :crystal_ball: Next steps

    Reviewed by marandaneto at 2021-12-20 09:26
  • 12. [Flutter Web] Unable to define SENTRY_AUTH_TOKEN via --dart-define

    Environment

    Flutter Web

    How do you use Sentry? Sentry SaaS (sentry.io)

    Which SDK and version? Flutter 2.8.1, sentry_dart_plugin: ^1.0.0-beta.1

    Steps to Reproduce

    In pubspec.yaml:

    sentry:
      project: projectname
      org: orgname
    

    In terminal:

    flutter build web --dart-define SENTRY_AUTH_TOKEN=64CHARLONGSTR
    flutter pub run sentry_dart_plugin
    

    Expected Result

    I expected it to work :D

    Actual Result

    [❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚] 0% reading config values..
    sentry-cli is not available under the assets folder, using pre-installed sentry-cli
    β˜‘ reading config values
    [❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚] 9% validating config values..
    Auth Token is empty, check 'auth_token' at pubspec.yaml or SENTRY_AUTH_TOKEN env. var.
    pub finished with exit code 1
    

    Did I do something wrong?

    Thanks!

    Reviewed by IvanDeluxe at 2021-12-24 15:24
  • 13. Support for setting commit

    Release tracking gets even better with Commit Hash info when the GitHub source repo is integrated with Sentry.

    The sentry releases set-commits command would be useful if integrated

    Reviewed by danilofuchs at 2021-12-10 15:12
  • 14. Support new sentry-cli architectures

    Similar to https://github.com/getsentry/sentry-android-gradle-plugin/issues/192

    https://github.com/getsentry/sentry-dart-plugin/blob/main/lib/src/configuration.dart#L146-L169

    https://github.com/getsentry/sentry-dart-plugin/tree/main/lib/assets

    Reviewed by marandaneto at 2021-10-01 08:18

Related

An E-Commerce application developed on Flutter, which helps to run the app on Android / IOS / Windows's OS / MacOS / Web Browser from a single codebase
An E-Commerce application developed on Flutter, which helps to run the app on Android / IOS / Windows's OS / MacOS / Web Browser from a single codebase

BuySmart An E-Commerce application developed on Flutter, which helps to run the app on Android / IOS / Windows's OS / MacOS / Web Browser from a singl

Apr 25, 2022
Responsive Blog Theme using Flutter | Web, macOS, Android, iOS
 Responsive Blog Theme using Flutter | Web, macOS, Android, iOS

Responsive Blog Theme using Flutter | Web, macOS, Android, iOS Watch it on YouTube Packages we are using: flutter_svg: link get: link Flutter recently

Jun 19, 2022
Movies application (Cubit, Android, iOS, macOS, Web, Windows)

Movies App (Cubit) Movies Application Platforms 1 - Android 2 - iOS 3 - macOS 4 - Web 5 - Windows Libraries & Tools Flutter 3.0.1 β€’ channel stable Da

Jun 7, 2022
Android Debug Drawer for faster development
Android Debug Drawer for faster development

Android Debug Drawer Faster development with Debug Drawer Features DeviceModule - common information about your device BuildModule - app build informa

Jun 5, 2022
A Flutter plugin that provides assets abstraction management APIs without UI integration, you can get assets (image/video/audio) on Android, iOS and macOS.
A Flutter plugin that provides assets abstraction management APIs without UI integration, you can get assets (image/video/audio) on Android, iOS and macOS.

photo_manager Photo/Assets management APIs for Flutter without UI integration, you can get assets (image/video/audio) from Android, iOS and macOS. 提供相

Jun 23, 2022
πŸ’³ A Flutter package for making payments via credo central. Provides support for both Android and iOS

?? Credo Package for Flutter TODO: Put a short description of the package here that helps potential users know whether this package might be useful fo

Dec 26, 2021
Flutter google maps - Flutter google maps Example
Flutter google maps - Flutter google maps Example

google_maps_example Development Setup Clone the repository and run the following

Jun 11, 2022
:bug: Flutter debug helper widget with common and custom actions
:bug: Flutter debug helper widget with common and custom actions

Debug Friend Flutter debug helper widget with common and custom actions This helps you reduce the development and testing time of new features Show so

Jul 1, 2022
UIWidget is a Unity Package which helps developers to create, debug and deploy efficient, cross-platform Apps.
UIWidget is a Unity Package which helps developers to create, debug and deploy efficient, cross-platform Apps.

⚠️ The main repository of UIWidgets has been moved to https://github.com/Unity-Technologies/com.unity.uiwidgets. Please visit the new site if you have

Jun 27, 2022
Write and debug tests easily, built on integration_test
Write and debug tests easily, built on integration_test

flutter_convenient_test: Write and debug tests easily, built on integration_test Quick demo full_video.mov Have questions? Though used in production e

Jun 22, 2022
Adds a side menu in all screens with debug information
Adds a side menu in all screens with debug information

Adds a side menu in all screens with debug information. You can decide which information to show and create new modules to include more information.

Jun 19, 2022
Dart wrapper via `dart:js` for webusb

Dart wrapper via dart:js for https://wicg.github.io/webusb/ Features canUseUsb g

Jan 25, 2022
Helper app to run code on Aliucord iOS via websocket.

aliucordebug A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if

Jan 25, 2022
flutter web app with given code and example. Step by step teaching how to build a flutter web app with backend

flutter_web A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if t

May 26, 2022
Native Drag and Drop for Flutter on iOS and MacOS

native_draggable A new flutter plugin project. Getting Started This project is a starting point for a Flutter plug-in package, a specialized package t

Jan 27, 2022
Package your Flutter app into OS-specific bundles (.dmg, .exe, etc.) via Dart or the command line.

flutter_distributor Package your Flutter app into OS-specific bundles (.dmg, .exe, etc.) via Dart or the command line. The flutter_distributor source

Jun 23, 2022
Immutable Dart collections via the builder pattern.

Built Collections for Dart Introduction Built Collections are immutable collections using the builder pattern. Each of the core SDK collections is spl

Jun 12, 2022
A simple yet powerful Flutter plugin for showing Toast at Android, iOS and Web.

Flutter Toast A simple yet powerful Flutter plugin for showing Toast at Android and iOS. Features: Native Toast Pure Flutter Toaster Installation Add

Dec 13, 2021