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 for further assistance.

Runtime issues

Browser windows opened before init completes are not tracked

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. 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.

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.

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 for the supported patterns.

Also verify that the Browser SDK is set up in the pages loaded by the renderer.

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 for the full setup.

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.

Some events are not dropped by beforeSendRum

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.

Further reading

Additional helpful documentation, links, and articles: