I can't figure out how to reproduce it locally but the issue occurs immediately on our staging and production servers for some reason.
Since the headers can now be arrays and iterables, this might not be properly accounting for that when attempting to call .split().
Pinning to undici@6.6.2 does not exhibit this behavior.
TypeError: request.headers.split is not a function
File "/var/app/node_modules/@sentry/node/cjs/integrations/undici/index.js", line 266, col 39, in setHeadersOnRequest
const headerLines = request.headers.split('\r\n');
File "/var/app/node_modules/@sentry/node/cjs/integrations/undici/index.js", line 177, col 7, in _onRequestCreate
setHeadersOnRequest(request, sentryTraceHeader, sentryBaggageHeader);
File "node:diagnostics_channel", line 142, col 9, in Channel.publish
File "/var/app/node_modules/undici/lib/core/request.js", line 189, col 23, in new Request
channels.create.publish({ request: this })
File "/var/app/node_modules/undici/lib/dispatcher/client.js", line 294, col 21, in [dispatch]
const request = new Request(origin, opts, handler)
File "/var/app/node_modules/undici/lib/interceptor/redirect-interceptor.js", line 11, col 16, in Intercept
return dispatch(opts, handler)
File "/var/app/node_modules/undici/lib/dispatcher/dispatcher-base.js", line 158, col 12, in [Intercepted Dispatch]
return dispatch(opts, handler)
File "/var/app/node_modules/undici/lib/dispatcher/dispatcher-base.js", line 179, col 40, in Client.dispatch
return this[kInterceptedDispatch](opts, handler)
File "/var/app/node_modules/undici/lib/dispatcher/pool-base.js", line 143, col 28, in [dispatch]
} else if (!dispatcher.dispatch(opts, handler)) {
File "/var/app/node_modules/undici/lib/dispatcher/dispatcher-base.js", line 150, col 29, in [Intercepted Dispatch]
return this[kDispatch](opts, handler)
File "/var/app/node_modules/undici/lib/dispatcher/dispatcher-base.js", line 179, col 40, in Pool.dispatch
return this[kInterceptedDispatch](opts, handler)
File "/var/app/node_modules/undici/lib/dispatcher/agent.js", line 105, col 23, in [dispatch]
return dispatcher.dispatch(opts, handler)
File "/var/app/node_modules/undici/lib/interceptor/redirect-interceptor.js", line 11, col 16, in Intercept
return dispatch(opts, handler)
File "/var/app/node_modules/undici/lib/dispatcher/dispatcher-base.js", line 158, col 12, in [Intercepted Dispatch]
return dispatch(opts, handler)
File "/var/app/node_modules/undici/lib/dispatcher/dispatcher-base.js", line 179, col 40, in Agent.dispatch
return this[kInterceptedDispatch](opts, handler)
File "node:internal/deps/undici/undici", line 10929, col 55, in <anonymous>
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/node
SDK Version
7.105.0
Framework Version
No response
Link to Sentry event
No response
SDK Setup
No response
Steps to Reproduce
I can't figure out how to reproduce it locally but the issue occurs immediately on our staging and production servers for some reason.
I think it's related to undici@6.7.0 changes:
nodejs/undici#2708
nodejs/undici#2879
and this line of code here:
sentry-javascript/packages/node/src/integrations/undici/index.ts
Line 311 in a818271
Since the headers can now be arrays and iterables, this might not be properly accounting for that when attempting to call
.split().Pinning to undici@6.6.2 does not exhibit this behavior.
Expected Result
No errors
Actual Result