Skip to content

docs(js): Add sendDefaultPii: true to all init calls #13408

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 34 commits into from
Apr 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/platforms/dart/common/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ import 'package:sentry/sentry.dart';
Future<void> main() async {
await Sentry.init((options) {
options.dsn = '___PUBLIC_DSN___';
// Adds request headers and IP for users,
// Adds request headers and IP for users, for more info visit:
// visit: https://docs.sentry.io/platforms/dart/data-management/data-collected/ for more info
options.sendDefaultPii = true;
// Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.
Expand Down
4 changes: 2 additions & 2 deletions docs/platforms/dart/guides/flutter/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Future<void> main() async {
await SentryFlutter.init(
(options) {
options.dsn = '___PUBLIC_DSN___';
// Adds request headers and IP for users,
// Adds request headers and IP for users, for more info visit:
// visit: https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/ for more info
options.sendDefaultPii = true;
// Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.
Expand Down Expand Up @@ -108,7 +108,7 @@ Future<void> main() async {
await SentryFlutter.init(
(options) {
options.dsn = '___PUBLIC_DSN___';
// Adds request headers and IP for users,
// Adds request headers and IP for users, for more info visit:
// visit: https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/ for more info
options.sendDefaultPii = true;
// Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.
Expand Down
4 changes: 2 additions & 2 deletions docs/platforms/dart/guides/flutter/manual-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Future<void> main() async {
await SentryFlutter.init(
(options) {
options.dsn = '___PUBLIC_DSN___';
// Adds request headers and IP for users,
// Adds request headers and IP for users, for more info visit:
// visit: https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/ for more info
options.sendDefaultPii = true;
// Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.
Expand Down Expand Up @@ -74,7 +74,7 @@ Future<void> main() async {
await SentryFlutter.init(
(options) {
options.dsn = '___PUBLIC_DSN___';
// Adds request headers and IP for users,
// Adds request headers and IP for users, for more info visit:
// visit: https://docs.sentry.io/platforms/dart/guides//data-management/data-collected/ for more info
Copy link
Member

Choose a reason for hiding this comment

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

This link 404s

Copy link
Contributor

@buenaflor buenaflor Apr 16, 2025

Choose a reason for hiding this comment

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

surprised that CI didn't catch this

edit: nvm it's a comment, of course ci won't

options.sendDefaultPii = true;
// Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.
Expand Down
13 changes: 11 additions & 2 deletions docs/platforms/javascript/guides/astro/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,15 @@ export default defineConfig({

### Client-Side Setup

```javascript {filename:sentry.client.config.js} {"onboardingOptions": {"performance": "7,10-13", "session-replay": "8,14-21"}}
```javascript {filename:sentry.client.config.js} {"onboardingOptions": {"performance": "11,14-17", "session-replay": "12,18-25"}}
import * as Sentry from "@sentry/astro";

Sentry.init({
dsn: "___PUBLIC_DSN___",

// Adds request headers and IP for users, for more info visit:
// https://docs.sentry.io/platforms/javascript/guides/astro/configuration/options/#sendDefaultPii
sendDefaultPii: true,

integrations: [
Sentry.browserTracingIntegration(),
Expand All @@ -121,12 +125,17 @@ Sentry.init({

### Server-Side Setup

```javascript {filename:sentry.server.config.js} {"onboardingOptions": {"performance": "10-13", "profiling": "2,6-9,14-17"}}
```javascript {filename:sentry.server.config.js} {"onboardingOptions": {"performance": "15-18", "profiling": "2,10-14,19-22"}}
import * as Sentry from "@sentry/astro";
import { nodeProfilingIntegration } from '@sentry/profiling-node';

Sentry.init({
dsn: "___PUBLIC_DSN___",

// Adds request headers and IP for users, for more info visit: for more info visit:
// https://docs.sentry.io/platforms/javascript/guides/astro/configuration/options/#sendDefaultPii
sendDefaultPii: true,

integrations: [
// Add our Profiling integration
nodeProfilingIntegration(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,16 @@ Note that you don't have to actually install an NPM package for this to work, as

Make sure you completed [step 1](#1-prerequisites) and [step 2](#2-add-the-sentry-lambda-layer) before proceeding.

```javascript {filename:index.js} {"onboardingOptions": {"performance": "5-8"}}
```javascript {filename:index.js} {"onboardingOptions": {"performance": "9-15"}}
const Sentry = require("@sentry/aws-serverless");

Sentry.init({
dsn: "___PUBLIC_DSN___",

// Adds request headers and IP for users, for more info visit:
// https://docs.sentry.io/platforms/javascript/guides/aws-lambda/configuration/options/#sendDefaultPii
sendDefaultPii: true,

// Add Tracing by setting tracesSampleRate and adding integration
// Set tracesSampleRate to 1.0 to capture 100% of transactions
// We recommend adjusting this value in production
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,26 @@ pnpm add @sentry/aws-serverless @sentry/profiling-node

Initialize and configure the SDK in your Lambda function Code. Call `Sentry.init` _outside_ of the handler function to avoid re-initializing the SDK on every invocation. Also, add the `Sentry.wrapHandler` wrapper around your function to automatically catch errors and performance data:

```javascript {filename:index.js} {"onboardingOptions": {"performance": "7-10", "profiling": "2,6,11-12"}}
```javascript {filename:index.js} {"onboardingOptions": {"performance": "12-18", "profiling": "2,10-11,17-21"}}
const Sentry = require("@sentry/aws-serverless");
const { nodeProfilingIntegration } = require("@sentry/profiling-node");

Sentry.init({
dsn: "___PUBLIC_DSN___",

// Adds request headers and IP for users, for more info visit:
// https://docs.sentry.io/platforms/javascript/guides/aws-lambda/configuration/options/#sendDefaultPii
sendDefaultPii: true,

integrations: [nodeProfilingIntegration()],

// Add Tracing by setting tracesSampleRate and adding integration
// Set tracesSampleRate to 1.0 to capture 100% of transactions
// We recommend adjusting this value in production
// Learn more at
// https://docs.sentry.io/platforms/javascript/configuration/options/#traces-sample-rate
tracesSampleRate: 1.0,

// Set sampling rate for profiling - this is relative to tracesSampleRate
profilesSampleRate: 1.0,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,26 @@ Follow steps 1 and 2 above to [install the SDK NPM package](#2-install) in your

Create a new file, for example `instrument.mjs` to initialize the SDK:

```javascript {filename:instrument.mjs} {"onboardingOptions": {"performance": "7-10", "profiling": "2,6,11-12"}}
```javascript {filename:instrument.mjs} {"onboardingOptions": {"performance": "12-18", "profiling": "2,10-11,17-21"}}
import * as Sentry from "@sentry/aws-serverless";
import { nodeProfilingIntegration } from "@sentry/profiling-node";

Sentry.init({
dsn: "___PUBLIC_DSN___",

// Adds request headers and IP for users, for more info visit:
// https://docs.sentry.io/platforms/javascript/guides/aws-lambda/configuration/options/#sendDefaultPii
sendDefaultPii: true,

integrations: [nodeProfilingIntegration()],

// Add Tracing by setting tracesSampleRate and adding integration
// Set tracesSampleRate to 1.0 to capture 100% of transactions
// We recommend adjusting this value in production
// Learn more at
// https://docs.sentry.io/platforms/javascript/configuration/options/#traces-sample-rate
tracesSampleRate: 1.0,

// Set sampling rate for profiling - this is relative to tracesSampleRate
profilesSampleRate: 1.0,
});
Expand Down
7 changes: 6 additions & 1 deletion docs/platforms/javascript/guides/azure-functions/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,17 @@ Sentry captures data by using an SDK within your application’s runtime. This m

To set up Sentry error logging for an Azure Function:

```javascript {tabTitle:async} {"onboardingOptions": {"performance": "9-15", "profiling": "2, 6-8, 16-18"}}
```javascript {tabTitle:async} {"onboardingOptions": {"performance": "14-20", "profiling": "2, 10-13, 21-23"}}
const Sentry = require("@sentry/node");
const { nodeProfilingIntegration } = require("@sentry/profiling-node");

Sentry.init({
dsn: "___PUBLIC_DSN___",

// Adds request headers and IP for users, for more info visit:
// https://docs.sentry.io/platforms/javascript/guides/azure-functions/configuration/options/#sendDefaultPii
sendDefaultPii: true,

integrations: [
nodeProfilingIntegration(),
],
Expand Down
6 changes: 5 additions & 1 deletion docs/platforms/javascript/guides/bun/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,17 @@ Once this is done, Sentry's Bun SDK captures unhandled exceptions as well as tra

You need to create a file named `instrument.js` that imports and initializes Sentry:

```javascript {filename: instrument.js} {"onboardingOptions": {"performance": "6-12"}}
```javascript {filename: instrument.js} {"onboardingOptions": {"performance": "10-16"}}
import * as Sentry from "@sentry/bun";

// Ensure to call this before importing any other modules!
Sentry.init({
dsn: "___PUBLIC_DSN___",

// Adds request headers and IP for users, for more info visit:
// https://docs.sentry.io/platforms/javascript/guides/bun/configuration/options/#sendDefaultPii
sendDefaultPii: true,

// Add Performance Monitoring by setting tracesSampleRate
// Set tracesSampleRate to 1.0 to capture 100% of transactions
// We recommend adjusting this value in production
Expand Down
26 changes: 21 additions & 5 deletions docs/platforms/javascript/guides/capacitor/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,18 @@ Configuration should happen as early as possible in your application's lifecycle
Then forward the `init` method from the sibling Sentry SDK for the framework you use, such as Angular in this example:


```typescript {tabTitle: Angular 14+} {filename: app.module.ts} {"onboardingOptions": {"performance": "13-16, 21-30, 50-59", "session-replay": "17-19, 31-37"}}
```typescript {tabTitle: Angular 14+} {filename: app.module.ts} {"onboardingOptions": {"performance": "17-20, 25-34, 54-63", "session-replay": "21-23, 35-42"}}
import * as Sentry from "@sentry/capacitor";
import * as SentryAngular from "@sentry/angular";

Sentry.init(
{
dsn: "___PUBLIC_DSN___",


// Adds request headers and IP for users, for more info visit:
// https://docs.sentry.io/platforms/javascript/guides/capacitor/configuration/options/#sendDefaultPii
sendDefaultPii: true,

// Set your release version, such as "[email protected]"
release: "my-project-name@<release-name>",
// Set your dist version, such as "1"
Expand Down Expand Up @@ -155,14 +159,18 @@ Sentry.init(
})
```

```typescript {tabTitle: Angular 12, 13} {filename: app.module.ts} {"onboardingOptions": {"performance": "14-17, 22-31, 51-60", "session-replay": "18-20, 32-38"}}
```typescript {tabTitle: Angular 12, 13} {filename: app.module.ts} {"onboardingOptions": {"performance": "18-21, 26-35, 55-64", "session-replay": "22-24, 36-40"}}
// Requires @sentry/capacitor V0.
import * as Sentry from "@sentry/capacitor";
import * as SentryAngular from "@sentry/angular-ivy";

Sentry.init(
{
dsn: "___PUBLIC_DSN___",

// Adds request headers and IP for users, for more info visit:
// https://docs.sentry.io/platforms/javascript/guides/capacitor/configuration/options/#sendDefaultPii
sendDefaultPii: true,

// Set your release version, such as "[email protected]"
release: "my-project-name@<release-name>",
Expand Down Expand Up @@ -220,13 +228,17 @@ Sentry.init(
})
```

```typescript {tabTitle: React} {filename: index.tsx} {"onboardingOptions": {"performance": "13-16, 21-30, 46-55", "session-replay": "17-19, 29-37"}}
```typescript {tabTitle: React} {filename: index.tsx} {"onboardingOptions": {"performance": "17-20, 25-34, 50-59", "session-replay": "21-23, 33-41"}}
import * as Sentry from "@sentry/capacitor";
import * as SentryReact from "@sentry/react";

Sentry.init(
{
dsn: "___PUBLIC_DSN___",

// Adds request headers and IP for users, for more info visit:
// https://docs.sentry.io/platforms/javascript/guides/capacitor/configuration/options/#sendDefaultPii
sendDefaultPii: true,

// Set your release version, such as "[email protected]"
release: "my-project-name@<release-name>",
Expand Down Expand Up @@ -264,7 +276,7 @@ Sentry.init(
);
```

```typescript {tabTitle: Vue} {filename: main.ts} {"onboardingOptions": {"performance": "17-20, 25-34, 50-59", "session-replay": "21-23, 33-41"}}
```typescript {tabTitle: Vue} {filename: main.ts} {"onboardingOptions": {"performance": "21-24, 29-38, 54-63", "session-replay": "25-27, 37-45"}}
import * as Sentry from "@sentry/capacitor";
import * as SentryVue from "@sentry/vue";
import { createApp } from 'vue'
Expand All @@ -275,6 +287,10 @@ Sentry.init(
{
app,
dsn: "___PUBLIC_DSN___",

// Adds request headers and IP for users, for more info visit:
// https://docs.sentry.io/platforms/javascript/guides/capacitor/configuration/options/#sendDefaultPii
sendDefaultPii: true,

// Set your release version, such as "[email protected]"
release: "my-project-name@<release-name>",
Expand Down
7 changes: 6 additions & 1 deletion docs/platforms/javascript/guides/cloudflare/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,18 @@ To use this SDK, add the `sentryPagesPlugin` as [middleware to your Cloudflare P
We recommend adding a `functions/_middleware.js` for the middleware setup so that Sentry is initialized for your entire
app.

```javascript {filename:functions/_middleware.js} {"onboardingOptions": {"performance": "7-10"}}
```javascript {filename:functions/_middleware.js} {"onboardingOptions": {"performance": "11-15"}}
import * as Sentry from "@sentry/cloudflare";

export const onRequest = [
// Make sure Sentry is the first middleware
Sentry.sentryPagesPlugin((context) => ({
dsn: "___PUBLIC_DSN___",

// Adds request headers and IP for users, for more info visit:
// https://docs.sentry.io/platforms/javascript/guides/cloudflare/configuration/options/#sendDefaultPii
sendDefaultPii: true,

// Set tracesSampleRate to 1.0 to capture 100% of spans for tracing.
// Learn more at
// https://docs.sentry.io/platforms/javascript/configuration/options/#traces-sample-rate
Expand Down
6 changes: 5 additions & 1 deletion docs/platforms/javascript/guides/deno/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,15 @@ Select which Sentry features you'd like to install in addition to Error Monitori

<OnboardingOptionButtons options={["error-monitoring", "performance"]} />

```javascript {tabTitle: Deno} {"onboardingOptions": {"performance": "5-11" }}
```javascript {tabTitle: Deno} {"onboardingOptions": {"performance": "9-15" }}
import * as Sentry from "npm:@sentry/deno";

Sentry.init({
dsn: "___PUBLIC_DSN___",

// Adds request headers and IP for users, for more info visit:
// https://docs.sentry.io/platforms/javascript/guides/deno/configuration/options/#sendDefaultPii
sendDefaultPii: true,

// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
Expand Down
5 changes: 4 additions & 1 deletion docs/platforms/javascript/guides/electron/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,13 @@ Sentry.init({

In the Electron `renderer` process:

```javascript {"onboardingOptions": {"performance": "5, 8-14", "session-replay": "6, 15-21"}}
```javascript {"onboardingOptions": {"performance": "8, 11-17", "session-replay": "9, 18-24"}}
import * as Sentry from "@sentry/electron/renderer";

Sentry.init({
// Adds request headers and IP for users, for more info visit:
// https://docs.sentry.io/platforms/javascript/guides/electron/configuration/options/#sendDefaultPii
sendDefaultPii: true,
integrations: [
Sentry.browserTracingIntegration(),
Sentry.replayIntegration(),
Expand Down
7 changes: 6 additions & 1 deletion docs/platforms/javascript/guides/ember/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Configuration should happen as early as possible in your application's lifecycle

This snippet includes automatic instrumentation to monitor the performance of your application, which registers and configures the Tracing integration, including custom [Ember instrumentation](./configuration/ember-options/).

```javascript {"onboardingOptions": {"performance": "11-17", "session-replay": "10, 18-24"}}
```javascript {"onboardingOptions": {"performance": "16-23", "session-replay": "14-15, 23-29"}}
import Application from "@ember/application";
import Resolver from "ember-resolver";
import loadInitializers from "ember-load-initializers";
Expand All @@ -46,6 +46,11 @@ import * as Sentry from "@sentry/ember";

Sentry.init({
dsn: "___PUBLIC_DSN___",

// Adds request headers and IP for users, for more info visit:
// https://docs.sentry.io/platforms/javascript/guides/ember/configuration/options/#sendDefaultPii
sendDefaultPii: true,

integrations: [Sentry.replayIntegration()],

// Set tracesSampleRate to 1.0 to capture 100%
Expand Down
7 changes: 6 additions & 1 deletion docs/platforms/javascript/guides/gatsby/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,16 @@ module.exports = {
Then, configure your `Sentry.init`. For this, create a new file called `sentry.config.js` in the root of your project and add the following code:


```javascript {filename:sentry.config.(js|ts)} {"onboardingOptions": {"performance": "6, 9-15", "session-replay": "7, 16-22"}}
```javascript {filename:sentry.config.(js|ts)} {"onboardingOptions": {"performance": "11, 15-20", "session-replay": "12, 21-27"}}
import * as Sentry from "@sentry/gatsby";

Sentry.init({
dsn: "___PUBLIC_DSN___",

// Adds request headers and IP for users, for more info visit:
// https://docs.sentry.io/platforms/javascript/guides/gatsby/configuration/options/#sendDefaultPii
sendDefaultPii: true,

integrations: [
Sentry.browserTracingIntegration(),
Sentry.replayIntegration(),
Expand Down
6 changes: 5 additions & 1 deletion docs/platforms/javascript/guides/gcp-functions/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,15 @@ Add `@sentry/google-cloud-serverless` as a dependency to `package.json`:
To set up Sentry for a Google Cloud Function:


```javascript {tabTitle:Http functions} {"onboardingOptions": {"performance": "5-11"}}
```javascript {tabTitle:Http functions} {"onboardingOptions": {"performance": "9-15"}}
const Sentry = require("@sentry/google-cloud-serverless");

Sentry.init({
dsn: "___PUBLIC_DSN___",

// Adds request headers and IP for users, for more info visit:
// https://docs.sentry.io/platforms/javascript/guides/gcp-functions/configuration/options/#sendDefaultPii
sendDefaultPii: true,

// Add Tracing by setting tracesSampleRate and adding integration
// Set tracesSampleRate to 1.0 to capture 100% of transactions
Expand Down
Loading