Skip to content

Conversation

Hebilicious
Copy link

@Hebilicious Hebilicious commented Sep 12, 2025

DESCRIBE YOUR PR

Improve the documentation with additional instructions for SSR and WebWorkers.

IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs to go live.

  • Urgent deadline (GA date, etc.):
  • Other deadline:
  • None: Not urgent, can wait up to 1 week+

SLA

  • Teamwork makes the dream work, so please add a reviewer to your PRs.
  • Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it.
    Thanks in advance for your help!

PRE-MERGE CHECKLIST

Make sure you've checked the following before merging your changes:

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs (subject matter experts)
  • PR was reviewed and approved by a member of the Sentry docs team

LEGAL BOILERPLATE

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

EXTRA RESOURCES

Copy link

vercel bot commented Sep 12, 2025

@Hebilicious is attempting to deploy a commit to the Sentry Team on Vercel.

A member of the Team first needs to authorize it.

@Hebilicious Hebilicious marked this pull request as ready for review September 12, 2025 16:17
Comment on lines +190 to +193
if (!import.meta.env.SSR) {
Sentry.addIntegration(Sentry.webWorkerIntegration({ worker }))
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential bug: The documentation example for web workers unconditionally calls new Worker(), which will cause a server crash in SSR environments where the Worker object is not defined.
  • Description: The documentation examples for using web workers with Vite and Nuxt unconditionally instantiate a Worker via new Worker(...). In a Server-Side Rendering (SSR) environment, which runs on Node.js, the Worker global is not available. This will cause the application to throw a ReferenceError: Worker is not defined and crash the server. The conditional check if (!import.meta.env.SSR) is only applied to the Sentry integration call, not the worker creation itself, which is where the error occurs. Developers copying this example for their SSR applications will experience server crashes.

  • Suggested fix: Wrap the entire worker creation and Sentry integration logic within a conditional block that checks if the code is running in a browser environment, for example: if (!import.meta.env.SSR) { const worker = new Worker(...); Sentry.addIntegration(...); }.
    severity: 0.85, confidence: 0.95

Did we get this right? 👍 / 👎 to inform future reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant