Navigation Menu

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

fix(browser): Handle case where fetch can be undefined #5973

Merged
merged 3 commits into from Oct 25, 2022

Conversation

AbhiPrasad
Copy link
Member

@AbhiPrasad AbhiPrasad commented Oct 17, 2022

fixes #5792.

Some users reported cases where the nativeFetch call was returning undefined. I have no idea how this happens, but in order for us to not send unnecessary errors to Sentry, let's be a little defensive in the usage of fetch.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 17, 2022

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.5 KB (+0.08% 🔺)
@sentry/browser - ES5 CDN Bundle (minified) 60.35 KB (+0.08% 🔺)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.13 KB (+0.06% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 53.68 KB (+0.07% 🔺)
@sentry/browser - Webpack (gzipped + minified) 19.87 KB (+0.07% 🔺)
@sentry/browser - Webpack (minified) 65.09 KB (+0.07% 🔺)
@sentry/react - Webpack (gzipped + minified) 19.89 KB (+0.06% 🔺)
@sentry/nextjs Client - Webpack (gzipped + minified) 45.81 KB (+0.03% 🔺)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 26.27 KB (+0.06% 🔺)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 24.65 KB (+0.05% 🔺)

@AbhiPrasad AbhiPrasad requested review from a team, lforst and Lms24 and removed request for a team October 17, 2022 15:54
@AbhiPrasad AbhiPrasad self-assigned this Oct 17, 2022
@AbhiPrasad AbhiPrasad marked this pull request as ready for review October 17, 2022 15:54
},
}));
} catch (e) {
return rejectedSyncPromise(e);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am wondering what the long term outcome of this change is... If we go forward with this, we will probably just hide the fact that fetch is undefined behind a network error client report. Is that what we want?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this is tricky. I also realized that this change means we don't respect rate-limiting on the SDK at all...

@AbhiPrasad
Copy link
Member Author

Even if we hide this behind weird client outcomes, let's still ship this so folks get unblocked.

@Lms24 Lms24 enabled auto-merge (squash) October 24, 2022 22:18
@Lms24 Lms24 disabled auto-merge October 24, 2022 22:18
@AbhiPrasad AbhiPrasad merged commit fe1a22c into master Oct 25, 2022
@AbhiPrasad AbhiPrasad deleted the abhi-try-catch-fetch branch October 25, 2022 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot read property 'then' of undefined (getNativeFetchImplementation)
2 participants