diegosouzapw/OmniRoute · error
AGENTBRIDGE_UPSTREAM_CA_CERT path does not exist: ${pemPath}
Error message
AGENTBRIDGE_UPSTREAM_CA_CERT path does not exist: ${pemPath} What it means
Error "AGENTBRIDGE_UPSTREAM_CA_CERT path does not exist: ${pemPath}" thrown in diegosouzapw/OmniRoute.
Source
Thrown at src/mitm/upstreamTrust.ts:31
* Configure undici's global dispatcher to trust a custom CA certificate.
*
* `undici` is loaded lazily (only when a CA is actually being configured) so
* that merely importing this module — which happens transitively from every
* MITM handler via `base.ts` — does not eagerly pull in undici's full index.
* That keeps the module importable in test/toolchain environments where the
* installed undici may be incompatible with the running Node version, and
* avoids loading a heavy dependency for the common no-CA path.
*
* @param pemPath - Absolute path to the PEM file. If undefined/empty, no-op.
* @throws {Error} With a safe error message (no stack trace) if pemPath is set
* but the file does not exist.
*/
export function configureUpstreamCa(pemPath?: string): void {
if (!pemPath) return;
if (!existsSync(pemPath)) {
// Safe error: message only contains the user-supplied path (no stack trace).
throw new Error(
`AGENTBRIDGE_UPSTREAM_CA_CERT path does not exist: ${pemPath}`,
);
}
const ca = readFileSync(pemPath, "utf8");
const require = createRequire(import.meta.url);
const { Agent, setGlobalDispatcher } = require("undici") as typeof import("undici");
setGlobalDispatcher(new Agent({ connect: { ca } }));
}
View on GitHub (pinned to a179ffed5b)
When it happens
Trigger: Thrown at src/mitm/upstreamTrust.ts:31 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25).
Data as JSON: /api/errors/f070b0e65e1872c7.
Report an issue: GitHub.