Skip to content
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

Required BrowserClientOptions properties contradict Troubleshooting documentation #5298

Closed
3 tasks done
cefn opened this issue Jun 23, 2022 · 3 comments · Fixed by getsentry/sentry-docs#5342
Closed
3 tasks done

Comments

@cefn
Copy link

cefn commented Jun 23, 2022

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which package are you using?

@sentry/browser

SDK Version

7.2.0

Framework Version

No response

Link to Sentry event

No response

Steps to Reproduce

The minimal invocation of BrowserClient (passing just the dsn in the options as demonstrated in the Javascript documentation) is a compiler error in Typescript. It suggests the Typescript types don't align with actual usage.

See also the discussion topic at #5293

Expected Result

The call to BrowserClient demonstrated in the Javascript documentation does compile in Typescript.

Actual Result

This is the compiler error you get when passing just a dsn option (as per the reference example in the Sentry documentation).

TS2345: Argument of type '{ dsn: string; }' is not assignable to parameter of type 'BrowserClientOptions'.   Type '{ dsn: string; }' is missing the following properties from type 'BrowserClientOptions': integrations, transport, stackParser
@cefn
Copy link
Author

cefn commented Jun 23, 2022

Update: This is actually documented in release notes for version 7 at...

https://github.com/getsentry/sentry-javascript/blob/master/MIGRATION.md#explicit-client-options

So the remaining issue is to align the Sentry documentation with the implementation. You can no longer invoke BrowserClient as...

const client = new BrowserClient({
  dsn: "https://db2c7b7ca7654a14b47912ee3ef4a2c5@o30291.ingest.sentry.io/262607",
});

@Lms24
Copy link
Member

Lms24 commented Jun 23, 2022

Hi @cefn and thanks for reporting.

Yes, as you already found out, we changed the ClientOptions and documented the change in several places, including the release notes/migration guide. But you are completely right, we forgot to update the docs in the Troubleshooting page. Will do this soon.

@Lms24 Lms24 changed the title Required BrowserClientOptions properties contradict documentation - is Typescript supported? Required BrowserClientOptions properties contradict Troubleshooting documentation? Jun 23, 2022
@Lms24 Lms24 changed the title Required BrowserClientOptions properties contradict Troubleshooting documentation? Required BrowserClientOptions properties contradict Troubleshooting documentation Jun 23, 2022
@AbhiPrasad
Copy link
Member

So the remaining issue is to align the Sentry documentation with the implementation. You can no longer invoke BrowserClient as...

This is intentional API change, as manual usage of the client also requires users to opt-in to what dependencies they want (stacktrace parser, transport, integrations). This was essential for us to enable tree shaking, so we decided to do it this way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants