BrowserClient constructor demands many properties contra documentation #5293
-
How should I create a BrowserClient for our microfrontend in a type-safe way? There is already a call to Sentry.init() happening outside our microfrontend. Any errors we are able to catch that originate in our microfrontend code should be routed to our own dsn (with only uncaught errors propagating to the main hub). I attempted to create a BrowserClient as below in some typescript code (I randomised the DSN numbers)... const client = new BrowserClient({
dsn: 'https://[email protected]/23459345',
environment: NODE_ENV,
release: version,
}); However, the
Needing to fulfil What am I doing wrong, or is the typing of the call to the BrowserClient constructor flawed? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Changing the client constructor was on purpose, as it allowed for us to enable tree shaking for the SDKs. Please see our docs for more details: https://docs.sentry.io/platforms/javascript/configuration/tree-shaking/#tree-shaking-default-integrations. If you look at the tree shaking docs, you can see that creation of a browser client is quite simple, and that you can abstract it into a function if you need multiple clients. We know the docs are out of date, and we will fix them up! This is being tracked in #5298. |
Beta Was this translation helpful? Give feedback.
Changing the client constructor was on purpose, as it allowed for us to enable tree shaking for the SDKs. Please see our docs for more details: https://docs.sentry.io/platforms/javascript/configuration/tree-shaking/#tree-shaking-default-integrations. If you look at the tree shaking docs, you can see that creation of a browser client is quite simple, and that you can abstract it into a function if you need multiple clients.
We know the docs are out of date, and we will fix them up! This is being tracked in #5298.