Skip to content

docs(js): Update content in SvelteKit's manual quick start guide (source maps, csp) #13843

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

Merged
merged 7 commits into from
Jun 2, 2025

Conversation

inventarSarah
Copy link
Collaborator

DESCRIBE YOUR PR

In this PR I have:

  • reduced the source maps content in SvelteKit's manual quick start guide and moved it to the Source Maps page
  • moved content about CSP to the Troubleshooting page and added an Expandable to the manual quick start guide

I will move the build options and API content in a new PR (or two) to keep things focused.

Belongs to: #13634

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

EXTRA RESOURCES

Copy link

vercel bot commented May 27, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sentry-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 2, 2025 8:30am
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
changelog ⬜️ Ignored (Inspect) Visit Preview Jun 2, 2025 8:30am
develop-docs ⬜️ Ignored (Inspect) Visit Preview Jun 2, 2025 8:30am

Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

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

Thanks! The CSP section looks great already. I had a concern about the source maps configuration settings (see comments). TLDR: We should never set the auth token in code but only as env variables.

Realizing that the comment order in my review is a bit misleading for source maps. I recommend reading #13843 (comment) first :)

However, you still need to specify your Sentry auth token as well as your org and project slugs.
There are two ways to set them:

**Option 1**
Copy link
Member

Choose a reason for hiding this comment

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

m: The options here really only differ in how much users set as env variables vs. directly in code. Users can set project and org slugs in code but they should never set the auth token in code as it must remain a secret and shouldn't be committed.

So I'd recommend we:

  • always show the .env file for setting the SENTRY_AUTH_TOKEN
  • also show a complete .env file for option 1 (see my comment)
  • show both .env and vite.config.ts for option 2 (basically how we used to show it in manual setup).

Does this make sense?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for bringing this up -- I think I understood what you meant -> let me know if you have feedback on the changes.

I'll review the other SDKs to see whether we need to update this there as well next week. It would be ideal to be consistent here.

Copy link

codecov bot commented May 28, 2025

Bundle Report

Changes will increase total bundle size by 465 bytes (0.0%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
sentry-docs-server-cjs 11.22MB 471 bytes (0.0%) ⬆️
sentry-docs-client-array-push 9.77MB -6 bytes (-0.0%) ⬇️

Affected Assets, Files, and Routes:

view changes for bundle: sentry-docs-client-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
static/chunks/pages/_app-*.js -3 bytes 868.7kB -0.0%
static/chunks/8165-*.js -3 bytes 410.1kB -0.0%
static/CTAoPRftGKDT_KABYsQV1/_buildManifest.js (New) 616 bytes 616 bytes 100.0% 🚀
static/CTAoPRftGKDT_KABYsQV1/_ssgManifest.js (New) 77 bytes 77 bytes 100.0% 🚀
static/MG13B8iZHzogkhfyu30qQ/_buildManifest.js (Deleted) -616 bytes 0 bytes -100.0% 🗑️
static/MG13B8iZHzogkhfyu30qQ/_ssgManifest.js (Deleted) -77 bytes 0 bytes -100.0% 🗑️
view changes for bundle: sentry-docs-server-cjs

Assets Changed:

Asset Name Size Change Total Size Change (%)
1729.js -3 bytes 1.75MB -0.0%
../instrumentation.js -3 bytes 1.08MB -0.0%
9523.js -3 bytes 1.05MB -0.0%
../app/[[...path]]/page.js.nft.json 160 bytes 399.59kB 0.04%
../app/platform-redirect/page.js.nft.json 160 bytes 399.51kB 0.04%
../app/sitemap.xml/route.js.nft.json 160 bytes 397.48kB 0.04%

sourceMapsUploadOptions: {
org: "___ORG_SLUG___",
project: "___PROJECT_SLUG___",
authToken: "process.env.SENTRY_AUTH_TOKEN",
Copy link
Member

Choose a reason for hiding this comment

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

this shouldn't be a string:

Suggested change
authToken: "process.env.SENTRY_AUTH_TOKEN",
authToken: process.env.SENTRY_AUTH_TOKEN,


You can also set your org and project slugs by passing a `sourceMapsUploadOptions` object to `sentrySvelteKit`, as seen in the example below. For a full list of available options, see the [Sentry Vite Plugin documentation](https://www.npmjs.com/package/@sentry/vite-plugin#options).

<OrgAuthTokenNote />
Copy link
Member

@Lms24 Lms24 May 28, 2025

Choose a reason for hiding this comment

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

I think we should still show the auth token in the .env file here, given that the token needs to be set somewhere. Otherwise, we should at least remove the <OrgAuthTokenNote> here.

Suggested change
<OrgAuthTokenNote />
<OrgAuthTokenNote />
\```bash {filename:.env}
# DO NOT commit this file to your repo. The auth token is a secret.
SENTRY_AUTH_TOKEN=___ORG_AUTH_TOKEN___
\```

(please ignore the backslashes, GH makes suggesting code blocks impossible :(

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

👍
I added the .env file here as suggested - thank you!

In Option 1, I also added OrgAuthTokenNote above the .env file

ignore: ["**/build/client/**/*"],
filesToDeleteAfterUpload: ["./build/**/*.map"],
},
authToken: "___ORG_AUTH_TOKEN___",
Copy link
Member

Choose a reason for hiding this comment

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

I realized we have the same problem here. We also shouldn't directly put the auth token into code here. I actually liked the previous version where we basically showed option 2. Happy to leave it up to you if it makes more sense to display both files in tabs in the same code block or one underneath the other.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

💯
Updated this section and added the .env with the auth token.
In general, it is best to provide only one option in a quick start guide, allowing the user to focus on setting things up quickly.

Copy link
Contributor

@coolguyzone coolguyzone left a comment

Choose a reason for hiding this comment

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

Looks good! Please address the step number comment before merging

Copy link
Member

@Lms24 Lms24 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 including my suggestions! LGTM!

@inventarSarah inventarSarah merged commit a4857f7 into master Jun 2, 2025
13 checks passed
@inventarSarah inventarSarah deleted the smi/sveltekit/clean-up-manual-qs branch June 2, 2025 12:32
antonpirker pushed a commit that referenced this pull request Jun 6, 2025
…rce maps, csp) (#13843)

<!-- Use this checklist to make sure your PR is ready for merge. You may
delete any sections you don't need. -->

## DESCRIBE YOUR PR
In this PR I have:
- reduced the source maps content in SvelteKit's manual quick start
guide and moved it to the Source Maps page
- moved content about CSP to the Troubleshooting page and added an
Expandable to the manual quick start guide

I will move the build options and API content in a new PR (or two) to
keep things focused.

Belongs to: #13634


## 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.): <!-- ENTER DATE HERE -->
- [ ] Other deadline: <!-- ENTER DATE HERE -->
- [x] 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](https://github.com/orgs/getsentry/teams/docs)


## EXTRA RESOURCES

- [Sentry Docs contributor guide](https://docs.sentry.io/contributing/)
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.

3 participants