From da8555d81704c4bd312e94e81298657e9faa9629 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 20 Jun 2026 10:36:43 +0000 Subject: [PATCH] Fix Proxmox connection by using undici's fetch instead of Node's global fetch Node's global fetch is backed by an internal undici version bundled with Node itself, which differs from the 'undici' npm package used for the insecure Agent (needed for Proxmox's self-signed cert). Passing an Agent from one undici version as the dispatcher for the other's fetch trips an internal handler-shape check, producing 'invalid onRequestStart method'. Importing fetch from the same undici package as the Agent keeps both on the same internal interface. --- backend/src/integrations/proxmox.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/src/integrations/proxmox.ts b/backend/src/integrations/proxmox.ts index d717697..8144430 100644 --- a/backend/src/integrations/proxmox.ts +++ b/backend/src/integrations/proxmox.ts @@ -1,4 +1,4 @@ -import { Agent } from 'undici' +import { Agent, fetch } from 'undici' import type { IntegrationAdapter, Resource } from './types.js' interface ProxmoxResourceEntry { @@ -37,7 +37,7 @@ export const proxmox: IntegrationAdapter = { const res = await fetch(`${baseUrl}/api2/json/version`, { headers: authHeader(apiKey), dispatcher: insecureDispatcher, - } as RequestInit) + }) if (!res.ok) return { ok: false, message: `HTTP ${res.status}` } return { ok: true, message: 'Connected' } } catch (err) { @@ -52,7 +52,7 @@ export const proxmox: IntegrationAdapter = { const res = await fetch(`${baseUrl}/api2/json/cluster/resources?type=vm`, { headers: authHeader(apiKey), dispatcher: insecureDispatcher, - } as RequestInit) + }) if (!res.ok) return [] const body = (await res.json()) as { data: ProxmoxResourceEntry[] } return body.data.map((entry) => ({