-
-
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
feat: Switch to new transports #4943
Conversation
687cb99
to
f282c6c
Compare
packages/core/src/baseclient.ts
Outdated
...((this._transport as unknown as { _api: Partial<APIDetails> })._api || {}), | ||
metadata: options._metadata || {}, | ||
}; | ||
this._transport = options.transport({ ...options.transportOptions, url: url || '' }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the key here, making sure the client still controls what is being passed in as options.
3dc2618
to
5d528c3
Compare
7e52ad5
to
870f57a
Compare
size-limit report 📦
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good. Some small things. We should definitely fix the tests before merging. Let me know if I can help there!
...options.transportOptions, | ||
...(options.httpProxy && { httpProxy: options.httpProxy }), | ||
...(options.httpsProxy && { httpsProxy: options.httpsProxy }), | ||
...(options.caCerts && { caCerts: options.caCerts }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's a good idea. That's what your changes do anyways right?
|
||
assertSentryEvent(requestBody, { | ||
assertSentryEvent(envelopes[1][2], { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is super wonky. We might want to write utility functions in the future to avoid these index shenanigans. (not this PR tho)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes we can improve this API a lot, I'll write up a improvement ticket.
packages/node-integration-tests/suites/sessions/crashed-session-aggregate/test.ts
Outdated
Show resolved
Hide resolved
- Inject transport into client instead of initializing it in the client in `setupTransport` (see | ||
[#4921](https://github.com/getsentry/sentry-javascript/pull/4921/)). If you are creating your own `Client` or | ||
calling `initAndBind`, you will have to supply your desired transport. Either provide a custom one or call | ||
`setupBrowserTransport` or `setupNodeTransport` for default transports, depending on your requirements. | ||
- Remove support for Opera browser pre v15 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this PR might be a good opportuinity to add the transport changes to the migration docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah agree, I'll add those.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Decided that I'll do this in a follow up PR!
Letting through requests with query params
Tests are finally passing! 🍾 @AbhiPrasad it would be great if you could check if the changes I made actually make sense. Edit: Actually I'm not sure if ember is flaky again or if it has failing tests for real. |
Ember tests were for real! Fixed them - hopefully this should be it 🤞 Update: It wasn't :( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, this looks really good to me, nice work @AbhiPrasad and @lforst! All my questions/remarks are more or less asked out of curiosity which is why I think this is ready to go regardless of the answers.
Admittedly, I only skimmed over the tests but they also seemed fine to me. I do have a few questions related to tests:
- It seems like we deleted the integration tests for the new transports (browser and node). Is there a reason for this?
- Also, we deleted the transport setup unit tests (the ones that test correct setup of fetch and xhr, http/s transports). I mean those weren't the most critical tests for sure but wouldn't it still be good to test this behaviour? Or did I miss something here (i.e. were they moved to a different file)?
Nice bundle size reduction btw! 🚀
I think this is due to the fact that we now don't have "new" transports anymore and the integration tests for the old transports now test the new ones. Keeping these tests would mean we would test stuff twice, which is unnecessary.
We entirely removed the setup functions and their tests. This is what we discussed in #4921 (comment). I think these setup functions are redundant if we don't have to deal with the old transports and so would be their tests. |
Thanks for answering the questions ❤️ @lforst Merging this in to unblock the rest of our work! |
This PR switches over from the old transports to the new ones. It deletes the functionality from the client of passing in transports explicitly and instead expects the transport to be passed in through options. Instead of passing in an instance of a transport to the client, we pass in a constructor function. This allows the client to control exactly what options are passed into the transport. ```ts this._transport = options.transport({ ...options.transportOptions, url }); ```
This PR switches over from the old transports to the new ones. It deletes the functionality from the client of passing in transports explicitly and instead expects the transport to be passed in through options. Instead of passing in an instance of a transport to the client, we pass in a constructor function. This allows the client to control exactly what options are passed into the transport. ```ts this._transport = options.transport({ ...options.transportOptions, url }); ```
This PR switches over from the old transports to the new ones. It deletes the functionality from the client of passing in transports explicitly and instead expects the transport to be passed in through options. Instead of passing in an instance of a transport to the client, we pass in a constructor function. This allows the client to control exactly what options are passed into the transport. ```ts this._transport = options.transport({ ...options.transportOptions, url }); ```
This PR switches over from the old transports to the new ones. It deletes the functionality from the client of passing in transports explicitly and instead expects the transport to be passed in through options. Instead of passing in an instance of a transport to the client, we pass in a constructor function. This allows the client to control exactly what options are passed into the transport. ```ts this._transport = options.transport({ ...options.transportOptions, url }); ```
Fixes #4660
This PR switches over from the old transports to the new ones. It deletes the functionality from the client of passing in transports explicitly and instead expects the transport to be passed in through options.
Instead of passing in an instance of a transport to the client, we pass in a constructor function. This allows the client to control exactly what options are passed into the transport.
Resolves https://getsentry.atlassian.net/browse/WEB-774