Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(plugin-server): upgrade undici to 7.24 (#63596)

Robbie1c04f6e87cb9
diff --git a/nodejs/package.json b/nodejs/package.json
index b082b42f0295..cf7aceecbef2 100644
--- a/nodejs/package.json
+++ b/nodejs/package.json
@@ -131,7 +131,7 @@
"tldts": "^6.1.57",
"typescript": "catalog:",
"ultimate-express": "2.0.9",
- "undici": "7.8.0",
+ "undici": "^7.24.0",
"undici-types": "7.3.0",
"uuid": "^11.1.1",
"xml-js": "^1.6.11",
diff --git a/nodejs/src/cdp/services/segment-destination-executor.service.ts b/nodejs/src/cdp/services/segment-destination-executor.service.ts
index 83d1580f406e..1d4e80bf44f2 100644
--- a/nodejs/src/cdp/services/segment-destination-executor.service.ts
+++ b/nodejs/src/cdp/services/segment-destination-executor.service.ts
@@ -77,6 +77,9 @@ const convertFetchResponse = <Data = unknown>(response: FetchResponse, text: str
arrayBuffer: () => {
throw new Error('Not implemented')
},
+ bytes: () => {
+ throw new Error('Not implemented')
+ },
blob: () => {
throw new Error('Not implemented')
},
diff --git a/nodejs/src/utils/request.ts b/nodejs/src/utils/request.ts
index 62063704313a..521f2c7fad2d 100644
--- a/nodejs/src/utils/request.ts
+++ b/nodejs/src/utils/request.ts
@@ -12,7 +12,6 @@ import {
RequestInfo,
RequestInit,
Response,
- errors,
request,
fetch as undiciFetch,
} from 'undici'
@@ -58,21 +57,23 @@ export type FetchResponse = {
dump: () => Promise<void>
}
-export class SecureRequestError extends errors.UndiciError {
+// These extend Error, not undici's UndiciError: UndiciError defines a code-based Symbol.hasInstance, so every
+// UndiciError subclass matches `instanceof` against every other one, which would defeat isFetchResponseRetriable.
+export class SecureRequestError extends Error {
constructor(message: string) {
super(message)
this.name = 'SecureRequestError'
}
}
-export class InvalidRequestError extends errors.UndiciError {
+export class InvalidRequestError extends Error {
constructor(message: string) {
super(message)
this.name = 'InvalidRequestError'
}
}
-export class ResolutionError extends errors.UndiciError {
+export class ResolutionError extends Error {
constructor(message: string) {
super(message)
this.name = 'ResolutionError'
@@ -316,7 +317,7 @@ export async function _fetch(url: string, options: FetchOptions = {}, dispatcher
headers: options.headers,
body: options.body,
dispatcher,
- maxRedirections: 0, // No redirects allowed by default
+ // request() does not follow redirects, so a response can never bounce to an unvalidated host
signal: options.timeoutMs ? AbortSignal.timeout(options.timeoutMs) : undefined,
})
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 79eeaf5c9b0d..16420a62cf8e 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -349,7 +349,7 @@ importers:
version: 0.25.12
jest:
specifier: ^29.7.0
puppeteer:
specifier: 19.0.0
version: 19.0.0([email protected])
@@ -1639,8 +1639,8 @@ importers:
specifier: 2.0.9
version: 2.0.9
undici:
- specifier: 7.8.0
- version: 7.8.0
+ specifier: ^7.24.0
+ version: 7.24.8
undici-types:
specifier: 7.3.0
version: 7.3.0
@@ -21935,10 +21935,6 @@ packages:
resolution: {integrity: sha512-6KQ/+QxK49Z/p3HO6E5ZCZWNnCasyZLa5ExaVYyvPxUwKtbCPMKELJOqh7EqOle0t9cH/7d2TaaTRRa6Nhs4YQ==}
engines: {node: '>=20.18.1'}
- resolution: {integrity: sha512-vFv1GA99b7eKO1HG/4RPu2Is3FBTWBrmzqzO0mz+rLxN3yXkE4mqRcb8g8fHxzX4blEysrNZLqg5RbJLqX5buA==}
- engines: {node: '>=20.18.1'}
-
resolution: {integrity: sha512-i7qRCmY42zmCwnYlh9H2SvLEypEFGye5iRmEMKjcGi7zk9UquigRjFtTLz0TYqr0ZGLZhaMHl/foy1bZR+Cwlw==}
@@ -32037,7 +32033,7 @@ snapshots:
'@swc/core': 1.15.18
'@swc/jest': 0.2.37(@swc/[email protected])
expect-playwright: 0.8.0
jest-circus: 29.7.0
jest-environment-node: 29.7.0
jest-junit: 16.0.0
@@ -39696,7 +39692,7 @@ snapshots:
dependencies:
expect-playwright: 0.8.0
jest-circus: 29.7.0
jest-environment-node: 29.7.0
jest-process-manager: 0.4.0
@@ -40131,7 +40127,7 @@ snapshots:
dependencies:
ansi-escapes: 6.0.0
chalk: 5.6.2
jest-regex-util: 29.6.3
jest-watcher: 29.7.0
slash: 5.1.0
@@ -46263,8 +46259,6 @@ snapshots:
-
dependencies:
pathe: 2.0.3