-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Sentry detects a NW.js app as a browser extension and refuses to load #12668
Comments
Thank you for reporting this! Could it be that your application is running inside a shared environment like a VSCode extension, a Third-Party Widget or a library? I am not super familiar with NW.js but it seems to be running in a shared environment. If this is the case you can setup a client manually like described in the docs. |
NW.js is an Electron alternative that's a lot simpler and easier to get started with. However, due to the way it works internally, it treats applications sort of like they're Chrome extensions, which is triggering the shared environment code. Each NW.js application runs in its own process, there's no shared environment. One app can open multiple windows, but each one will function like a new browser tab, meaning they're mostly isolated from each other. NW.js is basically a web browser, without any of the browser chrome (tabs, url bar, etc), and with the ability to run Node.JS code alongside browser code for accessing system resources like the filesystem. Here's a minimal NW.js application:
{
"name": "helloworld",
"main": "index.html"
}
<title>Window Title</title>
<h1>Hello world</h1> To run it, download NW.js (use the SDK build, it has Chromium's DevTools built in), unzip it, and run Fortunately, the NW.js runtime provides a global There is another way to run NW.js, using It's worth noting that it is possible to open regular websites in an NW.js app (most simply, by setting |
Thanks for giving an overview over NW.js, much appreciated! :) |
Looks like our browser extension check that blocks SDK initalization via `Sentry.init` also blocked initializing the SDK in NW.js apps. This PR adds a check for the `window.nw` property to handle this case. fixes #12668
Hi, this was released with version 8.17.0. Please let me know if this issue should be reopened! |
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
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()
insdk.js
causes Sentry to function normally.For example, replacing the last line in that function with this code causes Sentry to work:
The text was updated successfully, but these errors were encountered: