Docs: note that Bun resources don't trust the dev cert via NODE_EXTRA_CA_CERTS (upstream Bun bug)
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:
- Certificate configuration — add a caution that Bun resources are currently affected by oven-sh/bun#44365 and don't reliably trust the dev certificate via
NODE_EXTRA_CA_CERTSeven though it's configured correctly, with the HTTP-endpoint workaround. - Set up JavaScript apps in the AppHost — a similar pointer near the Bun (
AddBunApp) hosting integration section would help.
@hansmbakker @IEvangelist Is this issue open for contribution? I would be glad to step in
Hi @webmekanic - for sure, we're always open for contributions!
Please note that it is fixed upstream