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

Tunnel only as a fallback on network errors #9476

Closed
mbrevda opened this issue Nov 7, 2023 · 8 comments
Closed

Tunnel only as a fallback on network errors #9476

mbrevda opened this issue Nov 7, 2023 · 8 comments

Comments

@mbrevda
Copy link

mbrevda commented Nov 7, 2023

Problem Statement

It would be great if tunnel was used as a fallback in the case of a detected network error and not the default. This would conserve lots of bandwidth on high-volume sites by not sending all requesters unnecessarily.

Solution Brainstorm

It might be possible to parse the dsn and place a test call to the sentry API to test but it seems like something that could be easily incorporated in the SDK and should be a development concern.

@lforst
Copy link
Member

lforst commented Nov 8, 2023

Hi, thanks for the idea! I like it.

Thoughts:

  • I hope network errors caused by ad-blockers are detectable somehow.
  • We could add an option that is called something like tunnelOnNetworkError or similar.
  • Right now this could actually be implemented via a custom transport with not too much effort.

I don't think this is a priority for us at the moment so I'll backlog it. We may get to it one day or somebody contributes a good solution.

@getsantry getsantry bot removed the status in GitHub Issues with 👀 Nov 8, 2023
@lforst lforst changed the title use tunnel only as a fallback Tunnel only as a fallback on network errors Nov 8, 2023
@mbrevda
Copy link
Author

mbrevda commented Nov 8, 2023

Don't think adblockers are detectable per se, happy to always fall back on any network error. Can you share a link or example for a custom transport?

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 Nov 8, 2023
@lforst
Copy link
Member

lforst commented Nov 8, 2023

@mbrevda You can take our fetch transport as an example:

export function makeFetchTransport(
options: BrowserTransportOptions,
nativeFetch: FetchImpl = getNativeFetchImplementation(),
): Transport {

@getsantry getsantry bot removed the status in GitHub Issues with 👀 Nov 8, 2023
@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 Nov 21, 2023
@mbrevda
Copy link
Author

mbrevda commented Nov 21, 2023

It seems there is different internal handling when a tunnel is used (for example, when creating the envelope). Is a custom transport all that's needed here?

@lforst
Copy link
Member

lforst commented Nov 21, 2023

You're right, the tunnel option will put the client key inside the payload as opposed to the query param. I guess you could forward the client key with a mechanism like headers and the tunnel server adds it back as a query param.

@mbrevda
Copy link
Author

mbrevda commented Nov 22, 2023

seems like lots of work for userland - seems like it be much simpler to just allow fallback to tunnel on network error (or based on a predicted function)

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 Nov 22, 2023
@lforst
Copy link
Member

lforst commented Nov 22, 2023

seems like lots of work for userland - seems like it be much simpler to just allow fallback to tunnel on network error (or based on a predicted function)

I agree. It's the usual factors that are the reason why it is not implemented like this already: Complexity, Bundle Size, Development & Maintenance Efforts.

@AbhiPrasad
Copy link
Member

We'll be doing this as part of #14248 - closing this issue so we can track it there instead.

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

No branches or pull requests

3 participants