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(replay): Add additional safeguards for capturing network bodies #9506

Merged
merged 3 commits into from
Nov 10, 2023

Conversation

mydea
Copy link
Member

@mydea mydea commented Nov 9, 2023

This adds additional safeguards around fetch/xhr body capturing for replay.
I added additional try-catch in all places that depend on networkCaptureBodies.

This also types the fetch/xhr hints as Partial to ensure we guard against any of the things not actually being defined, to be on the safe side.

Hopefully fixes #9339

@mydea mydea requested review from billyvg and c298lee November 9, 2023 12:14
@mydea mydea self-assigned this Nov 9, 2023
Copy link
Contributor

github-actions bot commented Nov 9, 2023

size-limit report 📦

Path Size
@sentry/browser (incl. Tracing, Replay) - Webpack (gzipped) 65.42 KB (+0.14% 🔺)
@sentry/browser (incl. Tracing, Replay) - Webpack with treeshaking flags (gzipped) 55.63 KB (+0.1% 🔺)
@sentry/browser (incl. Tracing) - Webpack (gzipped) 30.98 KB (-0.01% 🔽)
@sentry/browser - Webpack (gzipped) 21.3 KB (-0.01% 🔽)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (gzipped) 61.95 KB (+0.09% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (gzipped) 29.1 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped) 21.24 KB (-0.01% 🔽)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (minified & uncompressed) 195.42 KB (+0.1% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (minified & uncompressed) 88.32 KB (0%)
@sentry/browser - ES6 CDN Bundle (minified & uncompressed) 63.3 KB (0%)
@sentry/browser (incl. Tracing) - ES5 CDN Bundle (gzipped) 31.81 KB (-0.01% 🔽)
@sentry/react (incl. Tracing, Replay) - Webpack (gzipped) 65.77 KB (+0.13% 🔺)
@sentry/react - Webpack (gzipped) 21.34 KB (0%)
@sentry/nextjs Client (incl. Tracing, Replay) - Webpack (gzipped) 82.49 KB (+0.1% 🔺)
@sentry/nextjs Client - Webpack (gzipped) 48.13 KB (-0.01% 🔽)
@sentry-internal/feedback - Webpack (gzipped) 16 KB (+0.01% 🔺)

Copy link
Member

@billyvg billyvg left a comment

Choose a reason for hiding this comment

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

Instead of swallowing up errors, we may want to log them so that we're able to debug them

if (body instanceof FormData) {
return _serializeFormData(body);
}
} catch {} // eslint-disable-line no-empty
Copy link
Member

Choose a reason for hiding this comment

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

Should we log here? or let it bubble up and log somewhere?

Copy link
Member Author

Choose a reason for hiding this comment

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

sure, I'll add a log for this case!

@mydea mydea force-pushed the fn/more-network-body-safeguards branch from 7de3c2b to ca842c1 Compare November 10, 2023 09:24
@mydea mydea force-pushed the fn/more-network-body-safeguards branch from a6ba600 to 6d0e4d4 Compare November 10, 2023 11:55
@mydea mydea merged commit 04e7be9 into develop Nov 10, 2023
@mydea mydea deleted the fn/more-network-body-safeguards branch November 10, 2023 15:16
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.

Request getting filtered by Replay integration.
2 participants