---
title: "Data Collected"
description: "See what data is collected by the Sentry JavaScript SDK."
url: https://docs.sentry.io/platforms/javascript/guides/aws-lambda/data-management/data-collected__v10.x/
---

# Data Collected for AWS Lambda (JavaScript) (SDK v10.x)

Sentry takes data privacy very seriously and has default settings in place that prioritize data safety, especially when it comes to personally identifiable information (PII) data. When you add the Sentry SDK to your application, you allow it to collect data and send it to Sentry during the runtime and build time of your application.

The category types and amount of data collected vary, depending on the integrations you've enabled in the Sentry SDK. This page lists data categories that the Sentry JavaScript SDK collects.

Options to control data collection

You can control most of the categories listed here with the [`dataCollection` option](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/configuration/options.md#dataCollection) (available since version `10.57.0`). Each category can be turned off individually, and some accept `{ allow: [...] }` or `{ deny: [...] }` lists to restrict which values are sent.

When you set `dataCollection` (even to an empty object `{}`), all categories are collected by default, with sensitive values filtered as described in the sections below.

When you don't set `dataCollection`, the deprecated `sendDefaultPii` option determines what the SDK collects. With `sendDefaultPii: true`, all categories are collected. Without it, the SDK does not collect the user's IP address, generative AI content, or database query data. It also turns off data taken from the body, such as tRPC input, and applies stricter filtering to headers, cookies, and query parameters.

Regardless of these options, you can always scrub any data before it's sent to Sentry. See [Scrubbing Sensitive Data](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/data-management/sensitive-data.md) for details.

## [HTTP Headers](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/data-management/data-collected__v10.x#http-headers)

By default, the SDK sends HTTP request and response headers.

Which headers are sent depends on the environment:

* In the browser, the SDK sends the `Referer` and `User-Agent` request headers (in version 10, these are sent regardless of the `httpHeaders` setting). The `httpClient` integration, which is not enabled by default, adds the request and response headers of failed requests.
* On the server, the headers of incoming requests are attached to error events and server spans. On Bun and Deno, the response headers of incoming requests are attached to server spans as well.
* The headers of outgoing requests are not collected by default.

The SDK filters headers attached as span attributes and headers captured by the `httpClient` integration: it keeps the header names and replaces the values of sensitive headers (names that match terms such as `auth`, `token`, or `password`) with `[Filtered]`. In version 10, request headers attached to error events on the server keep their original values; version 11 filters them as well.

Use the `dataCollection.httpHeaders` option to control header collection. Set `dataCollection: { httpHeaders: { request: false, response: false } }` to disable it, or use `{ allow: [...] }` or `{ deny: [...] }` on `request` and `response` to restrict which header values are sent. Since version `10.75.0`, you can also set one value that applies to both directions, for example `dataCollection: { httpHeaders: false }`.

When you don't set `dataCollection`, header collection depends on the deprecated `sendDefaultPii` option:

* With `sendDefaultPii: true`, the SDK sends headers with the filtering described above.
* Without it, the SDK still sends headers, but it also filters IP-related headers (names that match `forwarded`, `-ip`, `remote-`, `via`, or `-user`). The browser `httpClient` integration is an exception: when `dataCollection` is not set, it captures headers and cookies of failed requests only if `sendDefaultPii` is `true`.

## [Cookies](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/data-management/data-collected__v10.x#cookies)

By default, cookie collection is enabled. On the server, the cookies of incoming requests are sent with error events and server spans. In the browser, the SDK doesn't send cookies unless you enable the `httpClient` integration, which captures the cookies of failed requests.

The SDK filters cookie values attached as span attributes or captured by `httpClient`: it replaces the values of sensitive cookies (like `token` or `key`) with `[Filtered]`. In version 10, cookies attached to error events on the server keep their original values; version 11 filters them as well.

To disable cookie collection, set `dataCollection: { cookies: false }`. You can also restrict which cookie values are sent using `{ allow: [...] }` or `{ deny: [...] }`.

## [Information About Logged-in User](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/data-management/data-collected__v10.x#information-about-logged-in-user)

The Sentry SDK doesn't fill the user identity fields `user.id`, `user.email`, and `user.username` automatically. Data that you set with [`Sentry.setUser()`](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/apis.md#setUser) is always sent to Sentry. Some integrations (e.g. [User Feedback](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/user-feedback.md)) may also send data like the user ID, username, and email address when explicitly configured.

The `dataCollection.userInfo` option controls the identity data the SDK infers on its own, such as the user's IP address (see the next section). It doesn't affect data set with `Sentry.setUser()`.

## [Users' IP Address and Location](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/data-management/data-collected__v10.x#users-ip-address-and-location)

By default, the SDK sends the user's IP address. To disable it, set [`dataCollection: { userInfo: false }`](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/configuration/options.md#dataCollection).

In some integrations such as [`handleRequest`](https://docs.sentry.io/platforms/javascript/guides/astro.md#customize-server-instrumentation) in Astro, the user's IP address can also be sent by enabling `trackClientIp`.

If sending the IP address is enabled we will try to infer the IP address or use the IP address provided by `ip_address` in [`Sentry.setUser()`](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/apis.md#setUser). If you set `ip_address: null`, the IP address won't be inferred.

Even when this is disabled, IP addresses can still reach Sentry through collected HTTP headers, cookies, or query parameters (for example, the `X-Forwarded-For` header). Add these terms to the partially-matched deny lists for those categories so their values are filtered:

```JavaScript
Sentry.init({
  dsn: "https://<key>@o<orgId>.ingest.sentry.io/<projectId>",
  dataCollection: {
    httpHeaders: {
      request: { deny: ["forwarded", "-ip", "remote-", "via", "-user"] },
      response: { deny: ["forwarded", "-ip", "remote-", "via", "-user"] },
    },
    cookies: { deny: ["forwarded", "-ip", "remote-", "via", "-user"] },
    urlQueryParams: { deny: ["forwarded", "-ip", "remote-", "via", "-user"] },
  },
});
```

## [Request URL](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/data-management/data-collected__v10.x#request-url)

The request URL of outgoing and incoming HTTP requests is **always sent to Sentry**: the scheme, host, and path can't be turned off. Depending on your application, the path could contain PII data. For example, a URL like `/users/1234/details`, where `1234` is a user id (which may be considered PII).

The query string that's part of the URL is controlled by the `dataCollection.urlQueryParams` setting described in the next section.

## [Request Query String](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/data-management/data-collected__v10.x#request-query-string)

By default, the full request query string of outgoing and incoming HTTP requests is sent to Sentry. Depending on your application, this could contain PII data. For example, a query string like `?user_id=1234`, where `1234` is a user id (which may be considered PII).

Use the `dataCollection.urlQueryParams` option to control this. Set it to `false` to disable collection entirely, or use `{ allow: [...] }` / `{ deny: [...] }` to filter which values are sent. Values whose keys match the built-in sensitive denylist (terms like `auth`, `token`, `password`, and `secret`) are scrubbed automatically. The same rules apply to the query string inside the request URL: values are filtered in place, and `false` removes the query string from the URL entirely.

Sentry also has some additional [server-side data scrubbing](https://docs.sentry.io/security-legal-pii/scrubbing/server-side-scrubbing.md) in place to remove sensitive data from the query string.

## [Request Body](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/data-management/data-collected__v10.x#request-body)

On the server side, the body of incoming requests is captured by default. In version 10, the `dataCollection.httpBodies` option doesn't control this; use the HTTP integration options described below to disable or limit it.

The `dataCollection.httpBodies` option controls data taken from the body: tRPC input and Remix action form data (`"incomingRequest"`), and the results of Next.js server actions (`"outgoingResponse"`). The option also accepts `"outgoingRequest"` and `"incomingResponse"`, but the SDK doesn't currently capture those body types. All types are included by default. Set `dataCollection: { httpBodies: [] }` to opt out:

```js
Sentry.init({
  dsn: "https://<key>@o<orgId>.ingest.sentry.io/<projectId>",
  dataCollection: {
    httpBodies: [],
  },
});
```

The body size taken from the `content-length` header is always sent, even when the body itself is not captured.

On the server-side, you can disable the incoming request body with `maxIncomingRequestBodySize: "none"`, or skip specific requests with `ignoreIncomingRequestBody`, in the [HTTP Integration](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/configuration/integrations/http.md).

## [Server-Side Request Data](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/data-management/data-collected__v10.x#server-side-request-data)

On the server-side, the [RequestData Integration](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/configuration/integrations/requestdata.md) captures incoming request data including cookies, headers, query strings, request body (`data`), URL, and user information. The IP address is included when `dataCollection.userInfo` is enabled.

## [Response Body](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/data-management/data-collected__v10.x#response-body)

By default, the SDK doesn't capture response bodies, with one exception: the results of Next.js server actions are collected when `dataCollection.httpBodies` includes `"outgoingResponse"`, which is the default. To disable this, set `dataCollection: { httpBodies: [] }` or provide a subset that excludes `"outgoingResponse"`.

The SDK may still send the response body size, taken from the `content-length` header.

## [Source Context](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/data-management/data-collected__v10.x#source-context)

By default, SDKs set up by the Sentry CLI Wizard (`@sentry/wizard`) will enable uploading source maps to Sentry.

To disable source map upload, see [the Source Maps documentation](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/sourcemaps.md).

## [Local Variables In Stack Trace](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/data-management/data-collected__v10.x#local-variables-in-stack-trace)

The Sentry SDK does not send local variables in the error stack trace in client-side JavaScript SDKs.

You can enable sending local variables by setting `includeLocalVariables: true` in the `Sentry.init()` call. This activates the [Local Variables Integration](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/configuration/integrations/localvariables.md). The integration is added by default in Node.js-based runtimes.

## [Device, Browser, OS and Runtime Information](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/data-management/data-collected__v10.x#device-browser-os-and-runtime-information)

By default, the Sentry SDK sends information about the device and runtime to Sentry.

In browser environments, this information is obtained by the User Agent string. The User Agent string contains information about the browser, operating system, and device type.

In server-side environments, the Sentry SDK uses the `os` module to get information about the operating system and architecture.

## [Stack Trace Context Lines](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/data-management/data-collected__v10.x#stack-trace-context-lines)

By default, the [Context Lines Integration](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/configuration/integrations/contextlines.md) is enabled. This integration sends the surrounding lines of code for each frame in the stack trace. This can include PII data if the code contains PII information.

## [Database Queries](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/data-management/data-collected__v10.x#database-queries)

By default, the Sentry SDK sends database queries to Sentry. The query text is parameterized: literal data values are replaced with placeholders. This applies to SQL and MongoDB queries.

Queries made with the Supabase integration also include the data inside the query by default, such as filter values and write payloads. This data can include PII. Use the `dataCollection.databaseQueryData` option to control it. Set it to `false` to redact this data:

```JavaScript
Sentry.init({
  dsn: "https://<key>@o<orgId>.ingest.sentry.io/<projectId>",
  dataCollection: {
    databaseQueryData: false,
  },
});
```

The parameterized query text and structural metadata, such as the database system, the operation, and the table, are always sent. If you turn this option off, you keep the query performance data.

## [Queue Message Data](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/data-management/data-collected__v10.x#queue-message-data)

By default, the Sentry SDK sends the data passed to tasks within queues. For Kafka, this is the message key. Producers often use a user ID or a tenant ID as the message key, so this value can include PII.

Version 10 has no `dataCollection` option for this category (the `dataCollection.queues` option is available from version 11). To remove this data, scrub it before it's sent to Sentry. See [Scrubbing Sensitive Data](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/data-management/sensitive-data.md) for details.

Structural metadata, such as the messaging system, the topic, the partition, and the offset, is always sent.

## [tRPC Context](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/data-management/data-collected__v10.x#trpc-context)

By default, tRPC input is collected because `httpBodies` includes `"incomingRequest"` by default. To disable it, set `dataCollection: { httpBodies: [] }` or use a list that excludes `"incomingRequest"`.

If you exclude `"incomingRequest"`, tRPC input is not collected. You can still opt in per-middleware by setting `attachRpcInput: true` in the [`Sentry.trpcMiddleware()`](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/configuration/integrations/trpc.md) options, regardless of the global `dataCollection` setting.

## [GraphQL Operations](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/data-management/data-collected__v10.x#graphql-operations)

When you use a GraphQL integration, the Sentry SDK sends the operation name and the operation type to Sentry.

By default, the SDK also sends the GraphQL document (the query or mutation source text). Literal values inside the document are redacted, and the values of GraphQL variables are not collected. Use the `dataCollection.graphQL` option (available since version `10.66.0`) to turn off the document:

```JavaScript
Sentry.init({
  dsn: "https://<key>@o<orgId>.ingest.sentry.io/<projectId>",
  dataCollection: {
    graphQL: {
      document: false,
    },
  },
});
```

## [LLM Inputs And Responses](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/data-management/data-collected__v10.x#llm-inputs-and-responses)

When using AI integrations, metadata like model ID and used tokens is sent to Sentry.

The content of generative AI inputs (system instructions, prompt messages, tool definitions, and tool call arguments) and outputs (such as completion text and tool call results) might carry personal data. By default, the SDK records both inputs and outputs. Metadata like model ID and token counts is always collected.

The same setting applies to MCP servers instrumented with `wrapMcpServerWithSentry`. By default, the SDK records the inputs and outputs of tool calls, prompt retrievals, and resource reads. Use the wrapper's `recordInputs` and `recordOutputs` options to control recording per server.

Use the `dataCollection.genAI` option to control this. For example, opt out of recording AI message content while keeping the metadata:

```JavaScript
Sentry.init({
  dsn: "https://<key>@o<orgId>.ingest.sentry.io/<projectId>",
  dataCollection: {
    genAI: {
      inputs: false,
      outputs: false,
    },
  },
});
```
