Commit 778da01
fix: resolve SESSION_SECRET lazily to unblock production build (#29)
PR #20 removed the insecure SESSION_SECRET fallback by throwing at
module import when the env var is unset. But `next build` imports API
route modules during "Collecting page data", so the top-level throw
broke every deploy after #20 (build failed at /api/auth/me with
"SESSION_SECRET environment variable is required").
Move the check into a lazy getSessionSecret() called from hmac() at
request time. This preserves #20's security intent (no fallback,
requests fail if unset) while letting the build import route modules
cleanly. Verified: `next build` now succeeds with SESSION_SECRET unset.
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent 12b0e31 commit 778da01
1 file changed
Lines changed: 13 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | 5 | | |
10 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
11 | 19 | | |
12 | 20 | | |
13 | | - | |
| 21 | + | |
14 | 22 | | |
15 | 23 | | |
16 | 24 | | |
| |||
0 commit comments