Skip to content

feat(loader): Use region-aware CDN host for Loader Script#17476

Merged
sergical merged 3 commits intomasterfrom
sergical/feat/loader-script-de-region
Apr 27, 2026
Merged

feat(loader): Use region-aware CDN host for Loader Script#17476
sergical merged 3 commits intomasterfrom
sergical/feat/loader-script-de-region

Conversation

@sergical
Copy link
Copy Markdown
Member

DESCRIBE YOUR PR

The Loader Script snippet in the JavaScript install docs was hardcoded to https://js.sentry-cdn.com/..., which is wrong for organizations hosted in the EU (they need js-de.sentry-cdn.com). This PR makes the host dynamic for signed-in users and adds a short alert for unauthenticated readers.

  • Add a new JS_SDK_LOADER_HOST code keyword on ProjectCodeKeywords, derived from the project's DSN host (.ingest.de.js-de.sentry-cdn.com, else js.sentry-cdn.com).
  • Swap the 5 loader <script> URLs in docs/platforms/javascript/common/install/loader.mdx to use ___JS_SDK_LOADER_HOST___.
  • Register SignedInCheck as an MDX component and wrap a small <Alert> above the loader snippets telling unauthenticated readers to swap to js-de.sentry-cdn.com if their org is in the EU.

Refs #17471

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

The Loader Script snippet in the JavaScript install docs always pointed
at js.sentry-cdn.com, which is incorrect for organizations hosted in
the EU (which require js-de.sentry-cdn.com). Add a new
JS_SDK_LOADER_HOST code keyword derived from the project's DSN host so
signed-in users see the right URL for their selected project, and show
an alert to unauthenticated readers noting the EU variant.

Refs GH-17471
Co-Authored-By: Claude <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
develop-docs Ready Ready Preview, Comment Apr 27, 2026 3:45pm
sentry-docs Ready Ready Preview, Comment Apr 27, 2026 3:45pm

Request Review

Copy link
Copy Markdown
Member

@mydea mydea left a comment

Choose a reason for hiding this comment

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

seems good to me! Not a huge fan of having two info alerts above the snippet in the signed-out state 😅

Image

I am thinking we could possibly simply not show this in that case, as the user can't really do anything with this snippet anyhow when they are not signed in. E.g. they will generally not copy this snippet and change the examplePublicKey from the URL, but go to their settings and copy the whole loader URL anyhow. So I think it would also be OK to simply omit that message for signed out users. But no strong feelings, also fine with this as-is, and def. a big improvement over what we had before 🙏

sergical and others added 2 commits April 27, 2026 11:32
Per review feedback: signed-out readers can't really use the loader
snippet directly (they copy the full URL from their org settings), so
stacking a second info alert above the snippet for them is more noise
than help. Signed-in readers still get the dynamic host swap from the
___JS_SDK_LOADER_HOST___ keyword.

Co-Authored-By: Claude <noreply@anthropic.com>
@sergical
Copy link
Copy Markdown
Member Author

@mydea alert removed, good call - i didn't realize the logged out sstate already had a generic alert, forgot about it 🤦

@sergical sergical merged commit 348ee80 into master Apr 27, 2026
20 checks passed
@sergical sergical deleted the sergical/feat/loader-script-de-region branch April 27, 2026 16:02
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.

2 participants