Skip to content

Bug: with outbound set, npm and Node can't reach any HTTPS host from executor() commands #342

In review

Description

@cjol

When outbound returns a Fetcher, Node-based tools in the container can't make HTTPS requests. npm install fails with SELF_SIGNED_CERT_IN_CHAIN, after about 70 s of retries, and fetch fails with "self-signed certificate in certificate chain". So routing a container's egress breaks npm, pnpm and any Node script that makes requests, even when the Fetcher only passes requests through. The requests never reach the Fetcher.

Cause: ContainerExec adds CA_ENV to the env it passes to ctx.container.start(). That env reaches only the container's entrypoint. Commands run through ctx.container.exec() don't inherit it, and ContainerExec.exec() doesn't add it, so Node never gets NODE_EXTRA_CA_CERTS.

Fix: merge CA_ENV into each exec()'s env while the container is routed.

Evidence (0.11.4, cloudflare/debian-trixie, standard-4, outbound returning an entrypoint whose fetch is return fetch(request)):

Result
npm install left-pad SELF_SIGNED_CERT_IN_CHAIN after ~70 s, 2 of 2 runs, no requests at the entrypoint
The same, with NODE_EXTRA_CA_CERTS=/etc/cloudflare/certs/cloudflare-containers-ca.crt on the command succeeds in 3 s, all requests through the entrypoint
The same, without outbound succeeds in 1 s
env inside exec() no CA_ENV variables
/proc/1/environ all four CA_ENV variables

Activity

  1. added
    bug
    priority: high
    on Nov 24, 2026
  2. github-actions commented on Nov 24, 2026

    @github-actions
    Contributor

    I've opened a fix: #343

    • Cause: the CA_ENV variables reached only the container's entrypoint through start(), and ContainerExec.exec() never added them, so Node commands lacked NODE_EXTRA_CA_CERTS.
    • Change: exec() merges CA_ENV into each command's env while the container is routed through an egress.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpriority: high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions