Skip to content
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

Use CDN by default for JS SDK Loader #3213

Merged
merged 2 commits into from
Jul 30, 2024

Conversation

stayallive
Copy link
Contributor

In the Sentry UI you can get a "Loader Script", however currently this services a JS files that results in a console warning that the loader "isn't working anymore". However this is not very apparent from the UI and still works great on SaaS.

What the loader script currently serves (with some other boilerplate):

console.warn("The Sentry loader you are trying to use isn't working anymore, check your configuration.");

This has been discussed at length in multiple places and venues (most recent: getsentry/sentry#22715). And the conclusion looks to be that it's very hard to enable for self-hosted. @aldy505 event created a super cool container to server the needed files: getsentry/sentry#22715 (comment).

However... I decided to go digging around the code and it looks like it isn't as hard 🙈

It just wants a URL where to load the CDN bundles from and Sentry already provides this just fine of course.

Long story short, I'd like to propose adding this as the default config so the loader script also works on self-hosted with the Sentry CDN as backing for where to load the actual JS files from. Since it's currently just "broken" when installing self-hosted this seems like a nice improvement.

It would be better if the JS files are also self-hosteable, but I think having this as a default is better than the current broken default and easy to disable by just commenting this out. We can also leave this commented out by default of course but when you don't mind the JS files coming from the Sentry CDN this "fixes" the loader script 😄

Copy link
Collaborator

@aldy505 aldy505 left a comment

Choose a reason for hiding this comment

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

Finally, a fix!!

Comment on lines +367 to +371
#################
# JS SDK Loader #
#################

JS_SDK_LOADER_DEFAULT_SDK_URL = "https://browser.sentry-cdn.com/%s/bundle%s.min.js"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link

codecov bot commented Jul 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.01%. Comparing base (22605fd) to head (025ea4c).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3213   +/-   ##
=======================================
  Coverage   99.01%   99.01%           
=======================================
  Files           3        3           
  Lines         203      203           
=======================================
  Hits          201      201           
  Misses          2        2           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@IanWoodard IanWoodard left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@hubertdeng123 hubertdeng123 left a comment

Choose a reason for hiding this comment

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

thanks for putting this up

@hubertdeng123 hubertdeng123 merged commit cd7c460 into getsentry:master Jul 30, 2024
12 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Aug 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants