Skip to content

feat(js): Offer dataCollection setup step SDK v11 that writes a PII-reducing preset into Sentry.init - #1359

Merged
s1gr1d merged 13 commits into
masterfrom
sig/data-collection-setup-2-wizard-usage
Sep 23, 2026
Merged

s1gr1d merged 13 commits into
masterfrom
sig/data-collection-setup-2-wizard-usage

Conversation

@s1gr1d

@s1gr1d s1gr1d commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

Every framework change lives in its own commit (easier reviewing).

◇  Are you using Sentry SaaS or self-hosted Sentry?
│  Sentry SaaS (sentry.io)
│
◇  Do you already have a Sentry account?
│  Yes
│
◇  Select your Sentry project.
│  my-org/my-sveltekit-app
│
◇  Installed @sentry/sveltekit with yarn.
│
◆  Sentry collects request data, user info, and other context by
│  default. Do you want to reduce this to avoid sending personally
│  identifiable information (PII)?
│  More info: https://docs.sentry.io/platforms/javascript/configuration/options/#dataCollection
│  ○ Yes (Add a dataCollection config to Sentry.init() that turns off PII-heavy categories)
│  ● No (Keep the SDK defaults)
└

Depends on (merged) #1358

Closes getsentry/sentry-javascript#24551

s1gr1d and others added 10 commits September 22, 2026 15:48
Adds src/utils/data-collection.ts: a v11 gate (sdkSupportsDataCollection),
a yes/no prompt with telemetry (askShouldReduceDataCollection), and a
renderer for the PII-reducing dataCollection preset with deny lists
(getDataCollectionSnippet).

Also hoists the duplicated private getMajor helpers from sveltekit and
react-router into src/utils/semver.ts as getMajorVersion.
Prompts after install when the installed major is >= 11 and threads the
decision through ProjectInfo into the hooks templates, the
instrumentation.server template, and both magicast init-insert paths.
When accepted, the commented-out dataCollection hint is replaced by the
active preset; when declined, output is unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Threads the decision into the server/edge config templates, the
instrumentation-client file, and the copy-paste snippets. When accepted,
the commented-out dataCollection hint is replaced by the active preset;
when declined, output is unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Re-reads the installed SDK version after install and threads the
decision into the client and server config templates. When accepted, the
commented-out dataCollection hint is replaced by the active preset; when
declined, output is unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Re-reads the installed SDK version after install and splices the active
preset (with its comment block) into the magicast-generated client and
server init calls when accepted. When declined, output is unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Threads the decision into the server instrumentation template, the
manual copy-paste snippets, and the client entry codemod. When accepted,
the commented-out dataCollection hint is replaced by the active preset;
when declined, output is unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Re-reads the installed SDK version after install and splices the active
preset (with its comment block) into the magicast-generated Sentry.init
call when accepted. When declined, output is unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Re-reads the installed SDK version after install and threads the
decision into the worker template and the recast withSentry config
builder (preset comment attached as leading comments). When declined,
output is unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@s1gr1d
s1gr1d requested review from JPeer264 and chargome September 22, 2026 14:01
Base automatically changed from sig/data-collection-setup-1-utils to master September 22, 2026 14:23
Comment on lines +171 to +173
const reduceDataCollection =
sdkSupportsDataCollection(installedSdkVersion, '^10.73.0') &&
(await askShouldReduceDataCollection());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: The data collection prompt is never shown because the sdkSupportsDataCollection check requires SDK version 11+, but the wizard installs version 10.
Severity: LOW

Suggested Fix

Update the sdkSupportsDataCollection check to be compatible with the installed SDK version, or update the wizard to install version 11 or greater of the @sentry/nextjs package to ensure the data collection prompt is shown.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: src/nextjs/nextjs-wizard.ts#L171-L173

Potential issue: The data collection prompt, controlled by
`askShouldReduceDataCollection`, is never shown to users of the Next.js wizard. The
function `sdkSupportsDataCollection` checks if the installed `@sentry/nextjs` SDK major
version is 11 or greater to determine if the prompt should be displayed. However, the
wizard installs version `^10.73.0`, which always resolves to a major version of 10. As a
result, the condition `sdkMajor >= 11` is always false, preventing the prompt from ever
appearing.

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

@chargome

Copy link
Copy Markdown
Member

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit d08bf2c. Configure here.

@JPeer264 JPeer264 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we maybe add a link into the terminal with "More info: "?

s1gr1d and others added 2 commits September 23, 2026 10:08
Adds a "More info: <docs link>" line to the reduce-data-collection
prompt so users can read up on the categories before deciding.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…-setup-2-wizard-usage

# Conflicts:
#	src/nuxt/nuxt-wizard.ts
@s1gr1d
s1gr1d enabled auto-merge (squash) September 23, 2026 13:26
@s1gr1d
s1gr1d merged commit 8f22475 into master Sep 23, 2026
59 checks passed
@s1gr1d
s1gr1d deleted the sig/data-collection-setup-2-wizard-usage branch September 23, 2026 13:35
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.

Add explicit step for setting up dataCollection options in Sentry wizard

3 participants