feat(loader): Use region-aware CDN host for Loader Script#17476
feat(loader): Use region-aware CDN host for Loader Script#17476
Conversation
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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
mydea
left a comment
There was a problem hiding this comment.
seems good to me! Not a huge fan of having two info alerts above the snippet in the signed-out state 😅
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 🙏
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>
|
@mydea alert removed, good call - i didn't realize the logged out sstate already had a generic alert, forgot about it 🤦 |
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 needjs-de.sentry-cdn.com). This PR makes the host dynamic for signed-in users and adds a short alert for unauthenticated readers.JS_SDK_LOADER_HOSTcode keyword onProjectCodeKeywords, derived from the project's DSN host (.ingest.de.→js-de.sentry-cdn.com, elsejs.sentry-cdn.com).<script>URLs indocs/platforms/javascript/common/install/loader.mdxto use___JS_SDK_LOADER_HOST___.SignedInCheckas an MDX component and wrap a small<Alert>above the loader snippets telling unauthenticated readers to swap tojs-de.sentry-cdn.comif 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.
SLA
Thanks in advance for your help!
PRE-MERGE CHECKLIST
Make sure you've checked the following before merging your changes: