Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/browser
SDK Version
8.21.0
Framework Version
Node 22.2.0, Jest 29.7.0 (jsdom)
Link to Sentry event
No response
Reproduction Example/SDK Setup
A standard Jest setup with jsdom. Sentry init:
const options: BrowserOptions = {
enabled: $featureFlags.sentry,
dsn: 'redacted',
release: $DIM_VERSION,
environment: $DIM_FLAVOR,
ignoreErrors: [],
sampleRate: $DIM_VERSION === 'beta' ? 0.5 : 0.01, // Sample Beta at 50%, Prod at 1%
attachStacktrace: true,
// Only send trace headers to our own server
tracePropagationTargets: ['https://api.destinyitemmanager.com'],
integrations: [
browserTracingIntegration({
beforeStartSpan: (context) => ({
...context,
// We could use the React-Router integration but it's annoying
name: window.location.pathname
.replace(/\/\d+\/d(1|2)/g, '/profileMembershipId/d$1')
.replace(/\/vendors\/\d+/g, '/vendors/vendorId')
.replace(/index\.html/, ''),
}),
}),
],
tracesSampleRate: 0.001, // Performance traces at 0.1%
};
Steps to Reproduce
In 03257e0#diff-ebaa2ab57cde4323877d589a960abf7decc00a617a9eda536fdb2882bc7073eeR122 Sentry starts calling res.body.getReader()
. This is generally available in browser fetch
, but not in node-fetch
. We use node-fetch
to test our code from Jest.
Expected Result
Fetch would work, as it did with @sentry/browser
8.20.0.
Actual Result
TypeError: res.body.getReader is not a function
113 |
114 | try {
> 115 | return await fetchFunction(input, init);
| ^
116 | } finally {
117 | if (timer !== undefined) {
118 | clearTimeout(timer);
at resolveResponse (node_modules/.pnpm/@sentry+utils@8.[21](https://github.com/DestinyItemManager/DIM/actions/runs/10193490277/job/28280266147?pr=10364#step:7:22).0/node_modules/@sentry/utils/src/instrument/fetch.ts:125:37)
at streamHandler (node_modules/.pnpm/@[email protected]/node_modules/@sentry/utils/src/instrument/fetch.ts:170:9)
at originalFetch.apply.then.erroredHandlerData (node_modules/.pnpm/@[email protected]/node_modules/@sentry/utils/src/instrument/fetch.ts:81:13)
Metadata
Metadata
Assignees
Type
Projects
Status
No status