aspire.dev icon indicating copy to clipboard operation
aspire.dev copied to clipboard

Docs: note that Bun resources don't trust the dev cert via NODE_EXTRA_CA_CERTS (upstream Bun bug)

Open hansmbakker opened this issue 2 months ago • 3 comments

Problem

Aspire sets up development certificate trust for the various resource types, but for Bun resources (AddBunApp/addBunApp), that doesn't actually work today. Aspire configures NODE_EXTRA_CA_CERTS (and SSL_CERT_DIR) on Bun resources automatically, pointing at the generated dev cert. Confirmed by inspecting the actual running process's environment. But Bun's fetch() still rejects the certificate with:

TypeError: unable to verify the first certificate
  code: "UNABLE_TO_VERIFY_LEAF_SIGNATURE"

This is a genuine Bun bug, not an Aspire misconfiguration: Bun doesn't trust a pinned self-signed leaf certificate with basicConstraints: CA:FALSE via NODE_EXTRA_CA_CERTS, even though Node.js does for the exact same certificate and env var. I filed and reproduced this upstream with a minimal, Aspire-independent repro: oven-sh/bun#44365.

Net effect: any Bun-hosted resource (e.g. a CopilotKit/AG-UI runtime bridge, or any custom Bun service) that calls another Aspire project resource over HTTPS in local development will fail with UNABLE_TO_VERIFY_LEAF_SIGNATURE out of the box, with no Aspire-side configuration able to fix it. The only current workaround is to call the target resource's plain-HTTP endpoint instead of HTTPS for that specific call.

Request

Please add a note to the relevant docs pages so other users don't lose time rediscovering this:

hansmbakker avatar Oct 01 '26 09:10 hansmbakker

@hansmbakker @IEvangelist Is this issue open for contribution? I would be glad to step in

Webmekanic avatar Oct 09 '26 19:10 Webmekanic

Hi @webmekanic - for sure, we're always open for contributions!

IEvangelist avatar Oct 13 '26 20:10 IEvangelist

Please note that it is fixed upstream

hansmbakker avatar Oct 14 '26 08:10 hansmbakker