-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
docs(js): Move Electron content from quick start to other pages #15393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
inventarSarah
wants to merge
4
commits into
master
Choose a base branch
from
smi/quick-start/reorganize-electron
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
9c176d6
move advanced info from quick start to other pages
inventarSarah 0cc4247
fix display issue in options
inventarSarah 70c67a2
small style update & options order fix
inventarSarah 59d7d08
Merge branch 'master' into smi/quick-start/reorganize-electron
cleptric File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| --- | ||
| title: Electron Features | ||
| description: "Learn how Sentry's Electron SDK exposes features for first class integration with Electron." | ||
| excerpt: "" | ||
| --- | ||
|
|
||
| The Sentry Electron SDK offers Electron-specific features for first class integration with the framework. | ||
|
|
||
| <PageGrid /> |
95 changes: 95 additions & 0 deletions
95
docs/platforms/javascript/guides/electron/features/inter-process-communication.mdx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| --- | ||
| title: Inter-Process Communication | ||
| description: "Learn how the Sentry Electron SDK communicates across processes to capture detailed error data." | ||
| --- | ||
|
|
||
| To provide the most detailed context for all events, including native crashes, the SDK merges context, scope, and breadcrumbs from all processes into the Electron `main` process. | ||
|
|
||
| By default, the SDK attempts to establish communication from `renderer` to `main` using Electron's IPC APIs. If that fails, it falls back to a custom HTTP protocol. You can change this behavior using the <PlatformLink to="/configuration/options/#ipcMode">`ipcMode`</PlatformLink> option: | ||
|
|
||
| ```javascript | ||
| const { init, IPCMode } = require("@sentry/electron/main"); | ||
|
|
||
| init({ | ||
| dsn: "___PUBLIC_DSN___", | ||
| debug: true, | ||
| ipcMode: IPCMode.Protocol, // Options: IPCMode.Classic, IPCMode.Protocol, or IPCMode.Both | ||
| }); | ||
| ``` | ||
|
|
||
| ## Custom IPC Namespace | ||
|
|
||
| If your application uses multiple IPC channels, you can specify a custom namespace to prevent conflicts with Sentry's IPC channels. | ||
|
|
||
| Configure the same namespace across all three contexts: | ||
|
|
||
| **Main process:** | ||
|
|
||
| ```javascript | ||
| import * as Sentry from "@sentry/electron/main"; | ||
|
|
||
| Sentry.init({ | ||
| dsn: "___PUBLIC_DSN___", | ||
| ipcNamespace: "some-app", | ||
| }); | ||
| ``` | ||
|
|
||
| **Renderer process:** | ||
|
|
||
| ```javascript | ||
| import * as Sentry from "@sentry/electron/renderer"; | ||
|
|
||
| Sentry.init({ | ||
| ipcNamespace: "some-app", | ||
| }); | ||
| ``` | ||
|
|
||
| **Preload process:** | ||
|
|
||
| ```javascript | ||
| import { hookupIpc } from "@sentry/electron/preload-namespaced"; | ||
|
|
||
| hookupIpc("some-app"); | ||
| ``` | ||
|
|
||
| The SDK will prefix all IPC channels with your specified namespace (for example, `some-app`), helping to avoid conflicts with other channels in your application. | ||
|
|
||
| For more configuration options, see the <PlatformLink to="/configuration/options/#ipcNamespace">configuration options documentation</PlatformLink>. | ||
|
|
||
| ## Preload Injection | ||
|
|
||
| The SDK automatically injects a preload script using [`session.setPreloads(preloads)`](https://www.electronjs.org/docs/latest/api/session#sessetpreloadspreloads). By default, this only applies to the `defaultSession`. | ||
|
|
||
| If your app uses other sessions, pass them via the `getSessions` option in the `main` process: | ||
|
|
||
| ```javascript | ||
| import { session } from "electron"; | ||
| import * as Sentry from "@sentry/electron/main"; | ||
|
|
||
| Sentry.init({ | ||
| dsn: "___PUBLIC_DSN___", | ||
| getSessions: () => [ | ||
| session.defaultSession, | ||
| session.fromPartition("persist:my-session"), | ||
| ], | ||
| }); | ||
| ``` | ||
|
|
||
| <Alert> | ||
| If your app bundles the `main` process JavaScript, the SDK can't automatically | ||
| inject preload scripts because they won't be included in the packaged app. In | ||
| this case, the SDK will send events and scope updates via a custom HTTP | ||
| protocol and `window.fetch`. | ||
| </Alert> | ||
|
|
||
| ## Manual Preload | ||
|
|
||
| If you prefer to bundle and configure the preload script manually, import the SDK preload code into your own preload script: | ||
|
|
||
| ```javascript | ||
| import "@sentry/electron/preload"; | ||
| ``` | ||
|
|
||
| This exposes IPC to the isolated renderer via Electron's `contextBridge` API. | ||
|
|
||
| Check out our [example apps](https://github.com/getsentry/sentry-electron/tree/master/examples) for implementation details. |
72 changes: 72 additions & 0 deletions
72
docs/platforms/javascript/guides/electron/features/native-crash-reporting.mdx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| --- | ||
| title: Native Crash Reporting | ||
| description: "Learn how Sentry captures and processes native crashes from Electron processes." | ||
| --- | ||
|
|
||
| Sentry can process Minidumps created when any Electron process crashes. The SDK uploads these files when the application restarts (or immediately after a renderer crash). All event metadata, including user information and breadcrumbs, is included in these uploads. | ||
|
|
||
| Due to [macOS App Store sandbox restrictions](https://electronjs.org/docs/tutorial/mac-app-store-submission-guide#limitations-of-mas-build), native crashes can't be collected in Mac App Store builds. Native crash handling is automatically disabled in these environments. | ||
|
|
||
| <Expandable level="success" title="A word on data privacy"> | ||
| Minidumps are memory snapshots of a process at the moment it crashes. They may | ||
| contain sensitive information, such as environment variables, local path | ||
| names, or even in-memory data from input fields, including passwords. **Sentry | ||
| does not store these memory dumps**. Once processed, Sentry immediately | ||
| deletes them and strips all sensitive information from the resulting Issues. | ||
| </Expandable> | ||
|
|
||
| <Alert level="warning" title="Known issue"> | ||
| It's currently not possible to send events from native code (such as a C++ | ||
| extension). However, crashes will still be reported to Sentry if they happen | ||
| in a process where the SDK has been configured. Additionally, crash reports | ||
| from sub-processes may not be reported automatically on all platforms. This | ||
| feature will be added in a future SDK update. | ||
| </Alert> | ||
|
|
||
| ## Symbolication | ||
|
|
||
| To allow Sentry to process native crashes and fully provide symbolicated stack traces, you need to upload _Debug Information Files_ (sometimes also referred to as _Debug Symbols_ or just _Symbols_). Without these symbols, crash reports will show memory addresses instead of function names and file locations. | ||
|
|
||
| For standard Electron apps, enable the built-in Electron Symbol Server in Sentry: | ||
|
|
||
| 1. Go **Project Settings > Debug Files** | ||
| 2. Select `Electron` from the **Built-in Repositories** | ||
| 3. Add symbol servers for the platforms you're deploying to (if needed) | ||
|
|
||
| ### Custom Code and Extensions | ||
|
|
||
| If your application contains custom native extensions or you wish to symbolicate crashes from a spawned child process, upload their debug information manually during your build or release process. | ||
|
|
||
| For detailed instructions on uploading and managing debug symbols, see the [Debug Information Files](/platforms/javascript/guides/electron/data-management/debug-files/) documentation. | ||
|
|
||
| ## Child Processes | ||
|
|
||
| The SDK relies on the [Electron crashReporter](https://electronjs.org/docs/api/crash-reporter) to capture crash dumps. To receive crash reports for child processes, make sure the crash reporter is activated by either the SDK or manually (see [Manual Crash Reporting below](#manual-crash-reporting)). | ||
|
|
||
| Once active, the SDK automatically captures native crashes for the following processes: | ||
|
|
||
| | | `event.process` tag | macOS | Windows | Linux | | ||
| | --------------------------- | ------------------- | ----- | ------- | -------------- | | ||
| | Electron `main` process | `browser` | ✓ | ✓ | ✓ | | ||
| | Electron `renderer` process | `renderer` | ✓ | ✓ | ✓ | | ||
| | Electron `utilityProcess` | `utility` | ✓ | ✓ | ✓ <sup>1</sup> | | ||
| | `child_process.fork` | `node` | ✓ | ✓ | | | ||
| | `child_process.exec/spawn` | `unknown` | ✓ | | | | ||
|
|
||
| <sup>1</sup> Not supported in Electron v29.4.6. | ||
|
|
||
| ## Manual Crash Reporting | ||
|
|
||
| You can also capture native crashes by manually starting the [Electron `crashReporter`](https://electronjs.org/docs/api/crash-reporter). This approach provides symbolicated stack traces and system information, but doesn't include Electron-specific metadata, breadcrumbs, or context information. | ||
|
|
||
| This is useful when you can't use the full Electron SDK: | ||
|
|
||
| ```javascript | ||
| const { crashReporter } = require("electron"); | ||
| crashReporter.start({ | ||
| companyName: "YourCompany", | ||
| productName: "YourApp", | ||
| ignoreSystemCrashHandler: true, | ||
| submitURL: "___MINIDUMP_URL___", | ||
| }); | ||
| ``` |
52 changes: 52 additions & 0 deletions
52
docs/platforms/javascript/guides/electron/features/offline-support.mdx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| --- | ||
| title: Offline Support | ||
| description: "Learn how to customize the automatic caching of Sentry events while being offline." | ||
| --- | ||
|
|
||
| Sentry automatically handles offline event caching across the main and renderer processes to make sure you don't miss important information. | ||
|
|
||
| You can customize the queueing behavior with these optional [`transportOptions`](/platforms/javascript/guides/electron/configuration/options/#transportOptions) properties: | ||
|
|
||
| ```javascript | ||
| import * as Sentry from "@sentry/electron/main"; | ||
|
|
||
| Sentry.init({ | ||
| dsn: "___PUBLIC_DSN___", | ||
| transportOptions: { | ||
| /* The maximum number of days to keep an envelope in the queue. */ | ||
| maxAgeDays: 30, | ||
| /* The maximum number of envelopes to keep in the queue. */ | ||
| maxQueueSize: 30, | ||
| /** | ||
| * Called before we attempt to send an envelope to Sentry. | ||
| * | ||
| * If this function returns false, `shouldStore` will be called to determine if the envelope should be stored. | ||
| * | ||
| * Default: () => true | ||
| * | ||
| * @param envelope The envelope that will be sent. | ||
| * @returns Whether we should attempt to send the envelope | ||
| */ | ||
| shouldSend: (envelope: Envelope) => boolean | Promise<boolean>; | ||
| /** | ||
| * Called before an event is stored. | ||
| * | ||
| * Return false to drop the envelope rather than store it. | ||
| * | ||
| * Default: () => true | ||
| * | ||
| * @param envelope The envelope that failed to send. | ||
| * @param error The error that occurred. | ||
| * @param retryDelay The current retry delay in milliseconds. | ||
| * @returns Whether we should store the envelope in the queue | ||
| */ | ||
| shouldStore: (envelope: Envelope, error: Error, retryDelay: number) => boolean | Promise<boolean>; | ||
| /** | ||
| * Should the offline store flush shortly after startup. | ||
| * | ||
| * Defaults: false | ||
| */ | ||
| flushAtStartup: false; | ||
| }, | ||
| }); | ||
| ``` |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.