-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
BrowserOptions needs to support the TransportOptions generic. #13548
Comments
Thanks for reporting, I will have a look into this. |
Did you add Only when this is added, the additional options can be passed to @timfish Is there a specific reason the types are added to |
Yep, the import * as Sentry from "@sentry/browser";
Sentry.init({
dsn: "https://[email protected]/0",
transport: Sentry.makeBrowserOfflineTransport(Sentry.makeFetchTransport)
transportOptions: {
//
}
})
I might be wrong but I think passing the config like this was an API design choice long before the offline support was added. Maybe @AbhiPrasad can clarify?
That would be possible but we'd have to decide how we'd cater for merging settings from the two sources. Which would have priority, etc. |
It was done before my time, so we kept the same API for backwards compatibilities sake back when we worked on
|
IMHO the typecast strategy is not really ideal here, especially since e.g. Options etc. are not exported from the packages, so you need to install I can confirm that this: Sentry.init({
transport: Sentry.makeBrowserOfflineTransport(Sentry.makeFetchTransport),
transportOptions: {
flushAtStartup: true,
},
}); does not work, so the inferral of the transport type does not seem to work - @timfish could you take a look at this maybe? |
Since we're all mostly agreed that the separate The only downside I can see here is that if you want to pass options to the default transport, you'll need to pass the transport too. We could start exporting So this: import * as Sentry from '@sentry/browser';
Sentry.init({
dsn: '__DSN__',
transportOptions: {
headers: { something: 'some-header' }
}
}); Would become: import * as Sentry from '@sentry/browser';
Sentry.init({
dsn: '__DSN__',
transport: Sentry.makeDefaultTransport({
headers: { something: 'some-header' }
})
}); |
We spoke as a team and decided that for now we can deprecate and change accordingly. |
Unfortunately, I looks like we won't be able to keep a single We can either leave this change until the next major or we'll need to create new transports that always need to be called as a function. We could add new transports which don't start with Now: import * as Sentry from '@sentry/browser';
Sentry.init({
dsn: '__DSN__',
transport: Sentry.makeFetchTransport
}); After: import * as Sentry from '@sentry/browser';
Sentry.init({
dsn: '__DSN__',
transport: Sentry.fetchTransport()
}); Would depreciation of all the existing transports be considered too annoying for customers? How many users actually ref. the existing transports? |
Let's do this in v9 - ref #14149 |
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
8.27.0
Framework Version
react 16
Link to Sentry event
No response
Reproduction Example/SDK Setup
typescript version: 4.6.2=
Steps to Reproduce
Expected Result
No TypeScript errors.
Actual Result
The text was updated successfully, but these errors were encountered: