Skip to content

dataCollection docs example uses wrong shape for httpHeaders #18685

Description

@Prithvirajkumar

The code example in the sendDefaultPii deprecation section shows httpHeaders as a flat CollectBehavior value:

httpHeaders: { deny: ["forwarded", "-ip", "remote-", "via", "-user"] },

But the actual DataCollection TypeScript type (verified in @sentry/core@10.64.0) defines httpHeaders as a nested per-direction object:

httpHeaders?: {
  request?: CollectBehavior;
  response?: CollectBehavior;
};

Passing { deny: [...] } directly causes a TypeScript error because deny is not a valid key on { request?, response? }.

Workaround — use the nested form:

httpHeaders: {
  request: { deny: ["forwarded", "-ip", "remote-", "via", "-user"] },
  response: { deny: ["forwarded", "-ip", "remote-", "via", "-user"] },
},

cookies and queryParams use CollectBehavior directly and are correct in the example. Only httpHeaders is wrong.

--

View Junior Session in Sentry

Metadata

Metadata

Assignees

No one assigned

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions