Skip to content

Sentry detects a NW.js app as a browser extension and refuses to load #12668

@skylarmt

Description

@skylarmt

Is there an existing issue for this?

How do you use Sentry?

Self-hosted/on-premise

Which SDK are you using?

@sentry/browser

SDK Version

8.12.0

Framework Version

No response

Link to Sentry event

No response

SDK Setup

import * as Sentry from '@sentry/browser';
Sentry.init({
dsn: "[redacted]"
});

Steps to Reproduce

  1. Create a NW.js app.
  2. Install Sentry in it.

Expected Result

Sentry loads and functions normally.

Actual Result

Chromium devtools console shows error "You cannot run Sentry this way in a browser extension". Sentry doesn't load. Modifying the function shouldShowBrowserExtensionError() in sdk.js causes Sentry to function normally.

For example, replacing the last line in that function with this code causes Sentry to work:

// Running in NW.js, which appears like a browser extension but isn't
const isNWjs = (typeof nw !== "undefined");
return !!runtimeId && !isDedicatedExtensionPage && !isNWjs;

Metadata

Metadata

Assignees

Labels

Package: browserIssues related to the Sentry Browser SDK

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions