Skip to content

[Bug] Build fails when cert-aware fetch wrapper is checked against current Node typings #885

Description

@rksharma-owg

Summary

A clean install on current main fails to build because createCertAwareFetch() is declared as returning typeof fetch, while the returned async function does not include the static preconnect member now present in current Node typings.

Environment

  • OS: macOS
  • Node.js version: v22.23.1 (supported by the project's >=18 engine range)
  • Package manager: npm 10.9.8
  • Lockfile type: package-lock.json
  • CVE Lite CLI version: current main, commit 5d91e5e83796e80fcaa328706c3e1b9565b43037
  • @types/node: 24.12.0 resolved by npm ci

Command used

npm ci
npm run build

Expected behavior

A clean install on a supported Node version should type-check and allow the test suite to start. The injected fetch contract should describe the callable request behavior used by the scanner, without requiring unrelated static members from a particular Node typing release.

Actual behavior

src/utils/network.ts(187,3): error TS2741: Property 'preconnect' is missing in type '(input: RequestInfo | URL, init?: RequestInit) => Promise<Response>' but required in type 'typeof fetch'.

npm test -- --runInBand fails for the same reason because the E2E global setup runs the build.

Reproduction

  1. Clone current main.
  2. Run npm ci.
  3. Run npm run build.
  4. Observe TS2741 before any build artifacts are produced.

Relevant files or output

The mismatch is at src/utils/network.ts:174-187. No matching issue or open PR was found.

Proposed scope

Introduce a focused callable fetch type, use it for the cert-aware wrapper and production injection points, and add regression coverage. No runtime scan behavior should change.

I reproduced this on current main and can submit a focused fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions