Zod Validation Error on Startup
Symptom: The API crashes immediately with an error like:- Check your
.envfile (local) or platform env var settings (Render/Vercel) - Compare against
.env.examplein the relevant app directory - Make sure URLs are valid (include
https://) and strings aren’t empty
ENCRYPTION_KEY Validation Failure
Symptom: API crashes with:ENCRYPTION_KEY must be exactly 64 hexadecimal characters.
Fix: Generate a valid key:
CORS Errors in the Browser
Symptom: API requests from the frontend fail with CORS errors in the browser console. Cause: TheFRONTEND_URL env var on the API doesn’t include the frontend’s origin.
Fix: Set FRONTEND_URL to match your frontend URL exactly. For multiple origins, use comma-separated values:
http://, https://, or *. (wildcard).
Render Health Check Failing
Symptom: Render shows the service as unhealthy and keeps restarting it. Cause: The/health endpoint checks both the database (Neon) and Redis connections. If either is unreachable, it returns a 503.
Fix:
- Check that
DATABASE_URLandREDIS_URLare correct in Render’s env vars - Verify your Neon database is active (free tier databases pause after inactivity)
- Verify your Upstash Redis instance is running
- Check Render logs for the specific error in the health check response
Stale Schema After Database Changes
Symptom:db:push or db:migrate doesn’t detect your schema changes.
Cause: Drizzle reads from dist/ (compiled JS), not src/ (TypeScript). If you run drizzle-kit directly, it reads stale compiled files.
Fix: Always use the pnpm scripts — they run tsc before drizzle-kit:
Build Fails in Monorepo
Symptom: Vercel or Render build fails because a shared package can’t be found. Cause: The build command isn’t resolving monorepo dependencies correctly. Fix:- On Vercel: set the root directory to
apps/weband let Turborepo handle dependency resolution - On Render: the
render.yamlbuild command (pnpm install && pnpm --filter @folksbase/api build) handles this correctly - Make sure
pnpm-lock.yamlis committed — both platforms use--frozen-lockfile
Neon Database Connection Timeout
Symptom: API requests hang or timeout when querying the database. Cause: The project uses Neon’s HTTP driver, which works over standard HTTPS. Connection issues are usually network-related. Fix:- Check that the Neon database isn’t paused (free tier pauses after inactivity)
- Verify the
DATABASE_URLis correct and includes the correct project/branch - Check Neon’s status page for outages
- Remember: the HTTP driver is intentional for Render compatibility — don’t switch to the WebSocket driver
Playwright E2E Tests Failing in CI
Symptom: E2E tests pass locally but fail in CI. Cause: Usually a missing env var or the preview URL isn’t ready yet. Fix:- Ensure
E2E_USER_EMAILandE2E_USER_PASSWORDare set in CI secrets (real Supabase credentials) - Verify
PLAYWRIGHT_BASE_URLpoints to the correct preview URL - Check that the Vercel preview deployment finished before tests started
Existing Plaintext Keys After Enabling Encryption
Symptom: Settings withresend_api_key fail to load after deploying the encryption feature.
Cause: Existing plaintext keys in the database can’t be decrypted because they were never encrypted.
Fix: Either:
- Have users re-enter their Resend API keys after deploying (simplest)
- Run a one-time migration script to encrypt existing plaintext values