Skip to content

Commit ef5e14f

Browse files
Merge branch 'master' into feat/batch-processor-abnormal-terminations
2 parents f2c87cc + 65a3fcb commit ef5e14f

File tree

3 files changed

+90
-15
lines changed

3 files changed

+90
-15
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
title: Chrome Extensions
3+
description: "Learn how to set up the Sentry Flutter SDK for Chrome Extensions with Flutter Web."
4+
sidebar_order: 500
5+
sdk: sentry.dart.flutter
6+
categories:
7+
- dart
8+
- flutter
9+
---
10+
11+
## Overview
12+
13+
Chrome Extensions enforce strict Content Security Policy (CSP) rules that prevent dynamically loaded scripts. Since the Sentry Flutter SDK typically loads the Sentry JavaScript SDK dynamically for web platforms, you need to include the Sentry JavaScript bundle as a static asset instead.
14+
15+
## Required Setup
16+
17+
### 1. Download the Sentry JavaScript Bundle
18+
19+
Instead of loading the Sentry JavaScript SDK dynamically, you need to include it as a static asset:
20+
21+
1. Download the minified Sentry JavaScript bundle from the Sentry CDN. Use the version that is compatible with the Sentry Flutter SDK:
22+
[bundle.tracing.min.js](https://browser.sentry-cdn.com/9.40.0/bundle.tracing.min.js)
23+
24+
<Alert level="info">
25+
26+
Download the Sentry Javascript bundle with the appropriate version for your project. Check the [Sentry Flutter SDK releases](https://github.com/getsentry/sentry-dart/releases) to find the version of the Sentry Javascript SDK that is used in a specific Sentry Flutter SDK release.
27+
28+
</Alert>
29+
30+
2. Save this file to your Flutter Web project's `web/` directory.
31+
32+
### 2. Include the Script in Your HTML
33+
34+
Add the Sentry JavaScript bundle to your `web/index.html` file:
35+
36+
```html {filename:web/index.html}
37+
<!DOCTYPE html>
38+
<html>
39+
<head>
40+
<!-- Other head elements -->
41+
<script src="bundle.tracing.min.js" type="application/javascript"></script>
42+
</head>
43+
<body>
44+
<!-- Your app content -->
45+
</body>
46+
</html>
47+
```
48+
49+
### 3. Configure Your Flutter Build
50+
51+
Build your Flutter Web app for Chrome Extensions.
52+
53+
Ensure that the `bundle.tracing.min.js` file is included in your `web/` directory before building.
54+
55+
### 4. Upload Source Maps
56+
57+
After building your application, upload the generated source maps to Sentry to enable proper symbolication of stack traces using the [sentry_dart_plugin](/platforms/dart/guides/flutter/debug-symbols/dart-plugin/).

platform-includes/debug-symbols/dart-plugin/dart.flutter.mdx

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@ sentry:
2424
project: ___PROJECT_SLUG___
2525
org: ___ORG_SLUG___
2626
auth_token: ___ORG_AUTH_TOKEN___
27-
# Disable automatic upload of debug symbols
28-
# upload_debug_symbols: false
27+
# Absolute or relative path to the Dart symbol map file
28+
# Used to make obfuscated Flutter issue titles readable on iOS and Android
29+
# See the "Building Your Application" section below for more details on how to generate the symbol map file
30+
# Available since version 3.2.0 of the Sentry Dart Plugin
31+
dart_symbol_map_path: build/app/obfuscation.map.json
2932
# ___PRODUCT_OPTION_START___ source-context
3033
# Enable source context
3134
upload_sources: true
@@ -52,12 +55,17 @@ For more information, read the [Sentry Dart Plugin README](https://github.com/ge
5255

5356
Before running the plugin, build your Flutter application with one of the following commands. Obfuscated is encouraged for production builds, and will make uploading debug symbols necessary to get readable stack traces.
5457

58+
<Alert>
59+
The `--extra-gen-snapshot-options=--save-obfuscation-map=build/app/obfuscation.map.json` option is required to generate the symbol map file which is used to make the obfuscated Flutter issue titles readable on iOS and Android.
60+
Make sure to set the `dart_symbol_map_path` option in your `pubspec.yaml` file to the path of the `obfuscation.map.json` file.
61+
</Alert>
62+
5563
```bash {tabTitle: Obfuscated}
56-
flutter build apk --obfuscate --split-debug-info=<output-directory>
57-
flutter build ios --obfuscate --split-debug-info=<output-directory>
58-
flutter build macos --obfuscate --split-debug-info=<output-directory>
59-
flutter build windows --obfuscate --split-debug-info=<output-directory>
60-
flutter build linux --obfuscate --split-debug-info=<output-directory>
64+
flutter build apk --obfuscate --split-debug-info=<output-directory> --extra-gen-snapshot-options=--save-obfuscation-map=build/app/obfuscation.map.json
65+
flutter build ios --obfuscate --split-debug-info=<output-directory> --extra-gen-snapshot-options=--save-obfuscation-map=build/app/obfuscation.map.json
66+
flutter build macos --obfuscate --split-debug-info=<output-directory> --extra-gen-snapshot-options=--save-obfuscation-map=build/app/obfuscation.map.json
67+
flutter build windows --obfuscate --split-debug-info=<output-directory> --extra-gen-snapshot-options=--save-obfuscation-map=build/app/obfuscation.map.json
68+
flutter build linux --obfuscate --split-debug-info=<output-directory> --extra-gen-snapshot-options=--save-obfuscation-map=build/app/obfuscation.map.json
6169
```
6270

6371
```bash {tabTitle: Flutter Web}
@@ -83,7 +91,7 @@ If you don't obfuscate your build, the plugin won't upload debug symbols. Additi
8391

8492
## Android ProGuard Integration
8593

86-
If you have ProGuard (`minifyEnabled`) enabled, you must upload Android Proguard/R8 mapping files. You have two options:
94+
If you have ProGuard (`minifyEnabled`) enabled and you want to see proper native Android stacktraces, you must upload Android Proguard/R8 mapping files. You have two options:
8795

8896
1. **Use the Sentry Android Gradle Plugin (Recommended)**
8997

@@ -125,6 +133,7 @@ The following table lists all available configuration options for the Sentry Dar
125133
| `upload_debug_symbols` | boolean | `true` | Enables or disables automatic upload of debug symbols | |
126134
| `upload_source_maps` | boolean | `false` | Enables or disables automatic upload of source maps | |
127135
| `upload_sources` | boolean | `false` | Enables or disables source code upload | |
136+
| `dart_symbol_map_path` | string | | Absolute or relative path to the Dart symbol map file used to make obfuscated Flutter issue titles readable on iOS and Android | |
128137
| `url` | string | | The URL of your Sentry instance | `SENTRY_URL` |
129138
| `url_prefix` | URL prefix for JS source maps | e.g. ~/app/ (string) | no | - |
130139
| `wait_for_processing` | boolean | `false` | Whether to wait for server-side processing of uploaded files | |

platform-includes/debug-symbols/dart-plugin/dart.mdx

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@ sentry:
2424
project: ___PROJECT_SLUG___
2525
org: ___ORG_SLUG___
2626
auth_token: ___ORG_AUTH_TOKEN___
27-
# Disable automatic upload of debug symbols
28-
# upload_debug_symbols: false
27+
# Absolute or relative path to the Dart symbol map file
28+
# Used to make obfuscated Flutter issue titles readable on iOS and Android
29+
# See the "Building Your Application" section below for more details on how to generate the symbol map file
30+
# Available since version 3.2.0 of the Sentry Dart Plugin
31+
dart_symbol_map_path: build/app/obfuscation.map.json
2932
# ___PRODUCT_OPTION_START___ source-context
3033
# Enable source context
3134
upload_sources: true
@@ -52,12 +55,17 @@ For more information, read the [Sentry Dart Plugin README](https://github.com/ge
5255

5356
Before running the plugin, build your Flutter application with one of the following commands. Obfuscated is encouraged for production builds, and will make uploading debug symbols necessary to get readable stack traces.
5457

58+
<Alert>
59+
The `--extra-gen-snapshot-options=--save-obfuscation-map=build/app/obfuscation.map.json` option is required to generate the symbol map file which is used to make the obfuscated Flutter issue titles readable on iOS and Android.
60+
Make sure to set the `dart_symbol_map_path` option in your `pubspec.yaml` file to the path of the `obfuscation.map.json` file.
61+
</Alert>
62+
5563
```bash {tabTitle: Obfuscated}
56-
flutter build apk --obfuscate --split-debug-info=<output-directory>
57-
flutter build ios --obfuscate --split-debug-info=<output-directory>
58-
flutter build macos --obfuscate --split-debug-info=<output-directory>
59-
flutter build windows --obfuscate --split-debug-info=<output-directory>
60-
flutter build linux --obfuscate --split-debug-info=<output-directory>
64+
flutter build apk --obfuscate --split-debug-info=<output-directory> --extra-gen-snapshot-options=--save-obfuscation-map=build/app/obfuscation.map.json
65+
flutter build ios --obfuscate --split-debug-info=<output-directory> --extra-gen-snapshot-options=--save-obfuscation-map=build/app/obfuscation.map.json
66+
flutter build macos --obfuscate --split-debug-info=<output-directory> --extra-gen-snapshot-options=--save-obfuscation-map=build/app/obfuscation.map.json
67+
flutter build windows --obfuscate --split-debug-info=<output-directory> --extra-gen-snapshot-options=--save-obfuscation-map=build/app/obfuscation.map.json
68+
flutter build linux --obfuscate --split-debug-info=<output-directory> --extra-gen-snapshot-options=--save-obfuscation-map=build/app/obfuscation.map.json
6169
```
6270

6371
```bash {tabTitle: Flutter Web}
@@ -125,6 +133,7 @@ The following table lists all available configuration options for the Sentry Dar
125133
| `upload_debug_symbols` | boolean | `true` | Enables or disables automatic upload of debug symbols | |
126134
| `upload_source_maps` | boolean | `false` | Enables or disables automatic upload of source maps | |
127135
| `upload_sources` | boolean | `false` | Enables or disables source code upload | |
136+
| `dart_symbol_map_path` | string | | Absolute or relative path to the Dart symbol map file used to make obfuscated Flutter issue titles readable on iOS and Android | |
128137
| `url` | string | | The URL of your Sentry instance | `SENTRY_URL` |
129138
| `url_prefix` | URL prefix for JS source maps | e.g. ~/app/ (string) | no | - |
130139
| `wait_for_processing` | boolean | `false` | Whether to wait for server-side processing of uploaded files | |

0 commit comments

Comments
 (0)