fix: auto-generate CA cert in portless trust instead of erroring#128
fix: auto-generate CA cert in portless trust instead of erroring#128elliotllliu wants to merge 2 commits intovercel-labs:mainfrom
portless trust instead of erroring#128Conversation
When running `portless trust`, if the CA certificate doesn't exist yet, auto-generate it instead of returning the confusing error 'CA certificate not found. Run with --https first.' The --https flag is only valid for `portless proxy start`, not for `portless trust`, so the error message was a dead end. Now `portless trust` is self-contained: it generates the CA if needed, then trusts it. Fixes vercel-labs#124
|
@elliotllliu is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
|
Thanks for the fix! The approach of auto-generating the CA via One thing needed before merging: the test at |
Update the 'CA cert missing' test to reflect the new behavior where trustCA() auto-generates the CA instead of returning an error. The test now verifies that: - CA file is created when missing - No 'CA certificate not found' error is returned - Trust may still fail in CI (non-interactive) but for platform reasons
|
Updated in 40540bf — test now verifies the auto-generation behavior instead of expecting the old error message. Thanks for the review! |
|
@elliotllliu Thanks for the update! The concept is correct and the production code is good, but the test has a filename typo ("ca.crt" vs "ca.pem") that causes CI to fail. Once that's fixed this is good to merge. |
Summary
Fixes #124 —
portless trustno longer fails with "CA certificate not found. Run with --https first." on Windows (or any platform).Problem
portless trustchecks if the CA cert exists and errors with "Run with --https first" if it doesn't. But--httpsis only a valid flag forportless proxy start, notportless trust. Users hit a dead-end loop:Fix
When the CA cert doesn't exist,
trustCA()now auto-generates it viagenerateCA()before proceeding to trust it. This makesportless trustself-contained — no need to runportless proxy start --httpsfirst.Changes
packages/portless/src/certs.ts:trustCA()callsgenerateCA()when the CA cert is missing