---
title: Troubleshooting Electron SDK Issues
description: Learn how to troubleshoot common issues with the RUM Electron SDK.
breadcrumbs: >-
  Docs > RUM & Session Replay > Application Monitoring > Electron Monitoring >
  Troubleshooting Electron SDK Issues
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Troubleshooting Electron SDK Issues

## Overview{% #overview %}

If you experience unexpected behavior with the Datadog Electron SDK, use this guide to resolve issues. If you continue to have trouble, contact [Datadog Support](https://docs.datadoghq.com/help) for further assistance.

## Runtime issues{% #runtime-issues %}

### Browser windows opened before `init` completes are not tracked{% #browser-windows-opened-before- %}

Windows opened before `init` completes are not tracked until you reload them. They send nothing, not even the interactions that keep the session alive. If end users interact only with such windows, the session expires after 15 minutes of inactivity and no new session starts.

To fix this, wait for `init` to complete before you create any browser window, as described in [Initialize the SDK in the main process](https://docs.datadoghq.com/real_user_monitoring/application_monitoring/electron/setup.md#initialize-the-sdk-in-the-main-process). If a window must open earlier, reload it after `init` completes. To wait for the end user's consent, call `init` at startup with `trackingConsent: 'pending'` instead of deferring it. See [Tracking consent](https://docs.datadoghq.com/real_user_monitoring/application_monitoring/electron/advanced_configuration.md#tracking-consent).

### `init` returns `false`

`init` returns `false` if the configuration is invalid.

To fix this, check the configuration passed to `init`. Call `init` once per launch. To change the tracking consent later, call `setTrackingConsent` instead of calling `init` again. See [Tracking consent](https://docs.datadoghq.com/real_user_monitoring/application_monitoring/electron/advanced_configuration.md#tracking-consent).

### Renderer events are missing{% #renderer-events-are-missing %}

The main process accepts events only from renderers whose host is listed in `allowedRendererHosts`. Renderers whose host is not listed do not report through the main process. Their Browser SDK runs on its own, so their events are not part of the application's sessions.

To fix this, add the host of your renderer pages to `allowedRendererHosts`. For custom protocols, use the hostname component of the URL. For example, use `myapp` for `app://myapp/index.html`. See [Allowed renderer hosts](https://docs.datadoghq.com/real_user_monitoring/application_monitoring/electron/advanced_configuration.md#allowed-renderer-hosts) for the supported patterns.

Also verify that the [Browser SDK is set up](https://docs.datadoghq.com/real_user_monitoring/application_monitoring/browser/setup.md) in the pages loaded by the renderer.

### No profiles are collected{% #no-profiles-are-collected %}

Renderer profiling relies on the JS Self-Profiling API, which requires the page to be served with the `Document-Policy: js-profiling` HTTP response header. Pages loaded from `file://` are not served with this header by default, so profiling is not available for them.

To fix this, serve the renderer over a protocol where you control the response headers: a custom protocol that you handle with `protocol.handle`, or a local HTTP server. If you use a custom protocol, register it as privileged with the `standard` and `secure` privileges before the app is ready. See [Correlate RUM and Profiling](https://docs.datadoghq.com/real_user_monitoring/correlate_with_other_telemetry/profiling.md?platform=electron) for the full setup.

### A custom duration vital never stops{% #a-custom-duration-vital-never-stops %}

The SDK records a duration vital only when `startDurationVital` and `stopDurationVital` run in the same process. A vital started in the main process cannot be stopped in a renderer process, and vice versa.

To fix this, start and stop the vital in the same process. In renderer processes, use the equivalent `@datadog/browser-rum` APIs directly. See [Custom duration vitals](https://docs.datadoghq.com/real_user_monitoring/application_monitoring/electron/advanced_configuration.md#custom-duration-vitals).

### Some events are not dropped by `beforeSendRum`{% #some-events-are-not-dropped-by- %}

Only returning `false` from `beforeSendRum` drops an event. Any other return value keeps the event. View, execution context, and native crash events cannot be dropped.

To fix this, return `false` for events that can be dropped, and modify the editable fields of the other events instead. See [Modify or drop RUM events](https://docs.datadoghq.com/real_user_monitoring/application_monitoring/electron/advanced_configuration.md#modify-or-drop-rum-events).

## Further reading{% #further-reading %}

Additional helpful documentation, links, and articles:

- [Source code for electron-sdk](https://github.com/DataDog/electron-sdk)
- [Explore Real User Monitoring](https://docs.datadoghq.com/real_user_monitoring.md)
