GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Sentry inclusion in Content Scripts of a Chrome Extension · getsentry/sentry-javascript · Discussion #10357

Sentry inclusion in Content Scripts of a Chrome Extension #10357

vincer-textexpander started this conversation in General
Sentry inclusion in Content Scripts of a Chrome Extension #10357
@vincer-textexpander vincer-textexpander
Jan 25, 2024 · 1 comment
Return to top
Discussion options
  • Uh oh!

    There was an error while loading. Please reload this page.

  • Uh oh!

    There was an error while loading. Please reload this page.

vincer-textexpander
Jan 25, 2024

Hello, we have a chrome extension and we would like to use the Sentry SDK in the content scripts, however we have not found a definitive answer as to whether it is fully supported or not.

On one hand there is this Sentry SDK comment that advises against including Sentry in a content script:
"Side-note to extension authors: Injecting the Sentry SDK on arbitrary pages is highly discouraged. Injected Sentry SDKs might clash with a Sentry SDK already running on a page. Not only will this mean that the SDK you injected most likely won't work, but also you break the SDK the website is already running - ruining fun for everyone."

However, according to this Chrome Developer topic, Content Scripts are isolated from any other in-page scripts:
"Note: Not only does each extension run in its own isolated world, but content scripts and the web page do too. This means that none of these (web page, content scripts, and any running extensions) can access the context and variables of the others."

Given this, we'd like to get an official position on including Sentry in Chrome Extension Content Scripts, and if it is not recommended, please explain why.

Thank you.

You must be logged in to vote
All reactions

Replies: 1 comment

Comment options
  • Uh oh!

    There was an error while loading. Please reload this page.

vincer-textexpander
Jan 25, 2024
Author

Ah... I may have answered my own question by digging in the Sentry JS SDK Docs a bit deeper. The topic on using Sentry SDK in shared environments discusses using private Sentry Client/Hub instances in conjunction with manually captured errors. There are also considerations for integrations that affect Sentry's 'global state'.

So, the bottom line is that Sentry SDK can be used in Chrome Extension Content Scripts, but extra work must be done to properly isolate it.

You must be logged in to vote
All reactions
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
💬
General
Labels
None yet
1 participant
@vincer-textexpander
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.