Skip to content

BrowserClientOptions type should include BrowserClientReplayOptions #8857

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

Closed
3 tasks done
Sc4ramouche opened this issue Aug 22, 2023 · 1 comment · Fixed by #8921
Closed
3 tasks done

BrowserClientOptions type should include BrowserClientReplayOptions #8857

Sc4ramouche opened this issue Aug 22, 2023 · 1 comment · Fixed by #8921
Assignees
Labels
Package: react Issues related to the Sentry React SDK

Comments

@Sc4ramouche
Copy link

Sc4ramouche commented Aug 22, 2023

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/react

SDK Version

7.64.0

Framework Version

18.2.0

Link to Sentry event

No response

SDK Setup

const browserClient = new BrowserClient({
    enabled,
    ...clientOptions,
    ignoreErrors: [...DEFAULT_IGNORED_ERRORS, ignoredErrorRegex, ...(clientOptions.ignoreErrors || [])],
    environment,
    transport: makeFetchTransport,
    stackParser: defaultStackParser,
    integrations: [
      ...defaultIntegrations,
      new Integrations.BrowserTracing(),
      new Replay({ maskAllText: true, blockAllMedia: true }),
    ],
    replaysSessionSampleRate: 0,
    replaysOnErrorSampleRate: 0.1,
    beforeSend: filterSentryEvents,
} as ClientOptions & BrowserClientReplayOptions);

Steps to Reproduce

This issue is about types exposed by Sentry packages.

At the very last line of the setup provided above, we had to specify BrowserClientReplayOptions manually for the BrowserClient. Otherwise, TypeScript would report that passing replaysSessionSampleRate and replaysOnErrorSampleRate is not correct.

Expected Result

BrowserClientOptions type should should include BrowserClientReplayOptions.

Actual Result

TypeScript reports incorrect options passed to initialise BrowserClient.

Please let me know if I'm missing something here, or additional info is needed. Thank you!

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 Aug 22, 2023
@github-actions github-actions bot added the Package: react Issues related to the Sentry React SDK label Aug 22, 2023
@Lms24
Copy link
Member

Lms24 commented Aug 23, 2023

Hi, thanks for reporting! We'll look into this next week.

@getsantry getsantry bot removed the status in GitHub Issues with 👀 Aug 23, 2023
@Lms24 Lms24 self-assigned this Aug 31, 2023
Lms24 added a commit that referenced this issue Aug 31, 2023
…ns` (#8921)

Add missing replay and profiling options to the
`BrowserClientOptions` interface. Previously, we only exposed these
types to `BrowserOptions`. This led to type errors for users who
directly create a client, without using `Sentry.init` (as reported in
#8857).

While one would think that `BrowserClientOptions` is basically a
superset of `BrowserOptions` (leaving aside `stackparser`,
`integrations` and `transport`) this is in fact not the case, which IMO
is the core problem here. `BrowserClientOptions` only inherits the base
`Options` (which are shared between browser and node), in addition to
transport options. However, changing this so that,
`BrowserClientOptions` inherits from `BrowserOptions` is a breaking
change, so I opted to just add the missing options to
`BrowserClientOptions`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: react Issues related to the Sentry React SDK
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants