Commit cd5046c
fix(db): drop inlined RDS CA bundle, use Node default trust store (#2775)
URGENT: production runtime fix. Staging is hitting:
Error [PrismaClientKnownRequestError]
Invalid `prisma.member.findFirst()` invocation
Error opening a TLS connection: unable to get local issuer certificate
code: 'P1011', driverAdapterError: TlsConnectionError
Cause: PR #2772 set `ssl.ca = RDS_CA_BUNDLE` in the prisma adapter, which
*replaces* Node's trust store rather than augmenting it. Our bundle only
contains the 108 RDS-specific regional self-signed CAs — it does NOT
contain Amazon Root CA 1, which is where AWS RDS Proxy chains terminate
(and which lives in Node's default Mozilla bundle). So the chain failed
to validate at runtime under the strict-TLS branch.
Why apps/app and apps/portal didn't trip this in earlier checks:
- The /auth route returned 200 because that codepath doesn't query the
DB; it talks to apps/api over HTTP, and apps/api uses a different
prisma client (Docker, NODE_EXTRA_CA_CERTS at OS level).
- DB-touching SSR routes (e.g., /[orgId]/overview) are exactly what the
reported staging failure exercises.
Fix: drop the `ca:` field. Node's default trust store includes Amazon
Root CA 1, which is sufficient for chain validation against RDS Proxy.
Hostname check is still skipped (NLB topology — chain check still
rejects forged or wrong-CA certs). PRISMA_ALLOW_INSECURE_TLS=1 remains
the explicit insecure opt-out — the original Cubic finding fix is
preserved.
Files:
- packages/db/src/ssl-config.ts: drop RDS_CA_BUNDLE import + usage
- packages/db/src/client.test.ts: rewrite tests for new behavior (6 pass)
- apps/{app,portal,framework-editor}/prisma/client.ts: drop the ca: branch
- Delete: packages/db/{certs/rds-global-bundle.pem,src/rds-ca-bundle.ts,
scripts/generate-ca-bundle-ts.mjs} and the inlined rds-ca-bundle.ts
copies in apps/{app,portal,framework-editor}/prisma/ (~660KB removed)
- packages/db: 2.2.0 → 2.3.0 (also drops `certs` from `files` array)
- apps/api/prisma/client.ts: unchanged — Docker still uses
NODE_EXTRA_CA_CERTS at OS level and that path is fine.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 852dca7 commit cd5046c
12 files changed
Lines changed: 55 additions & 2871 deletions
File tree
- apps
- app/prisma
- framework-editor/prisma
- portal/prisma
- packages/db
- certs
- scripts
- src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | 4 | | |
7 | 5 | | |
8 | 6 | | |
| |||
28 | 26 | | |
29 | 27 | | |
30 | 28 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | 4 | | |
7 | 5 | | |
8 | 6 | | |
| |||
28 | 26 | | |
29 | 27 | | |
30 | 28 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
42 | 38 | | |
43 | 39 | | |
44 | 40 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | 4 | | |
7 | 5 | | |
8 | 6 | | |
| |||
28 | 26 | | |
29 | 27 | | |
30 | 28 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
42 | 38 | | |
43 | 39 | | |
44 | 40 | | |
| |||
This file was deleted.
0 commit comments