Skip to content

Only requests using apollo client, Response body of network in sentry session replay is undefined. #8345

Closed
getsentry/sentry-docs
#7210
@jabelic

Description

@jabelic

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/browser

SDK Version

7.55.2

Framework Version

Nuxt.js: 2.15.8, @apollo/client: 3.5.8

Link to Sentry event

No response

SDK Setup

  initErrorTracker(username: string): void {
    if (this.isInitializedSentry) return;
    this.sentry.init({
      dsn: "******************",
      environment: "development",
      release: "",
      integrations: [new this.sentry.BrowserTracing()],
      ignoreErrors: [/some error message/],
      tracesSampleRate: 0.01,
      replaysSessionSampleRate: 0.1,
      replaysOnErrorSampleRate: 1
    });
    this.sentry.configureScope(scope => scope.setUser({ id: username }));
    this.isInitializedSentry = true;
    this.log('sentry initialized.');
  }

  initSessionReplay(username: string): void {
    if (this.replay) return;
    const replay = new this.sentry.Replay({
      maskAllText: false,
      maskAllInputs: false,
      blockAllMedia: false,
      networkDetailAllowUrls: [/.*/],
      networkCaptureBodies: true
    });
    this.sentry.configureScope(scope => scope.setUser({ id: username }));
    this.sentry.getCurrentHub().getClient()?.addIntegration?.(replay);
    this.replay = replay;
    this.log('sentry replay initialized.');
  }

Steps to Reproduce

When replaying a Sentry session in this environment, the Network response body is undefined.

This problem only occurs for response bodies of API requests using the apollo client response bodies for fetch api requests can be retrieved.

Note that the networkDetailAllowUrls above is a sample, and in my environment, I have set the regular expression to allow only specific APIs to pass through. I have confirmed that the regular expression is correct.

Also, Content-Type of response is application/json.

Expected Result

In the Network tab of the sentry session replay, the response body should be visible.

Actual Result

Response body is undefined in the Network tab of sentry session replay. Response size has been retrieved.

sentry-session-replay-network

Metadata

Metadata

Assignees

Labels

Package: replayIssues related to the Sentry Replay SDK

Type

No type

Projects

Status

Waiting for: Product Owner

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions