Fix Render deployment for Stripe & email verification#49
Fix Render deployment for Stripe & email verification#49ChrisAdamsdevelopment wants to merge 3 commits into
Conversation
…fig diagnostics - Dockerfile runtime stage was missing the server/ directory, causing a module-not-found crash on boot (server.js requires ./server/*). - Frontend no longer hard-throws when VITE_API_URL is unset; empty base URL now correctly means same-origin requests for single-service deployments. - Add startup [Config] log summary so Stripe/email live-vs-mock state is visible in logs. - Add render.yaml blueprint and RENDER.md with the full env-var reference.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Reviewer's GuideFixes production deployment behavior and observability for Stripe/email on Render by copying the server directory into the Docker runtime image, relaxing the VITE_API_URL requirement for same-origin deployments, adding a startup config summary log, and introducing Render-specific docs and blueprint files. Flow diagram for API_BASE_URL resolution in app.tsxgraph TD
Start[Start app.tsx]
CheckEnv[Read import.meta.env.VITE_API_URL]
HasViteApiUrl{VITE_API_URL set?}
DevMode{DEV mode?}
UseEnv[Set API_BASE_URL to VITE_API_URL]
UseLocalhost[Set API_BASE_URL to http://localhost:3001]
UseRelative["Set API_BASE_URL to empty string (same-origin)"]
Start --> CheckEnv --> HasViteApiUrl
HasViteApiUrl -->|yes| UseEnv
HasViteApiUrl -->|no| DevMode
DevMode -->|yes| UseLocalhost
DevMode -->|no| UseRelative
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Resolves GHSA-c7w3-x93f-qmm8 (SMTP command injection) and related high-severity advisories flagged by 'npm audit --audit-level=high' in CI. The createTransport/sendMail API used by server/emailService.js is unchanged; server smoke test still boots and /api/health responds.
Resolves GHSA-cw26-7653-2rp5 (argument injection via newline in tag names), the last high-severity advisory failing 'npm audit --audit-level=high' in CI. The read/write/version/readRaw/end API used by server/processor.js is unchanged; verified end-to-end: write+read+full -all= wipe cycle works on MP4 (bundled ExifTool 13.59), all 13 unit tests pass, and the server smoke test boots.
|
Folded into #48 per the decision to ship everything as a single PR. The Render deploy fixes and security upgrades from this branch were merged into
Closing this one — review and merge #48 instead. Verified after merge: 28/28 tests pass, Generated by Claude Code |
Why Stripe and email verification "aren't working"
The server silently switches into mock/dev-fallback mode unless the right environment is set:
NODE_ENVis notproduction, checkout returns a fake success URL (no real Stripe charge) and verification/reset emails are only logged, never sent.NODE_ENV=productionbut Stripe vars are missing, the server exits on boot.So the fix is almost entirely environment configuration on Render — documented below — plus a few real code bugs found along the way.
Code fixes in this PR
server/directory at runtime. The runtime stage copied onlyserver.js+dist, butserver.jsrequires./server/processor,./server/emailService, etc. →MODULE_NOT_FOUNDcrash on boot when deployed via Docker. Now copiesserver/.VITE_API_URL. Itthrows on an empty base URL, but for a single-service (same-origin) Render deploy the correct value is empty (relative requests). Removed the throw so same-origin "just works";VITE_API_URLis now only needed when the frontend is hosted on a separate domain.[Config]log summary showing whether Stripe, Email, and Gemini are actually configured — so the logs immediately tell you if you're in mock mode.New docs / blueprint
render.yaml— Render Blueprint with a persistent disk for SQLite and all env-var keys pre-created.RENDER.md— full environment-variable reference and step-by-step setup, including the Stripe webhook.Required env vars on Render (summary)
Core:
NODE_ENV=production,JWT_SECRET,FRONTEND_URL,DB_PATH=/data/spectra.db(+ persistent disk).Stripe (all 4):
STRIPE_SECRET_KEY,STRIPE_WEBHOOK_SECRET,STRIPE_CREATOR_PRICE_ID,STRIPE_STUDIO_PRICE_ID.Email (all 5):
SMTP_HOST,SMTP_PORT,SMTP_USER,SMTP_PASS,SMTP_FROM.Optional:
GEMINI_API_KEY.Testing
node --check server.jspasses.npm run build(tsc + vite) passes cleanly.https://claude.ai/code/session_01Db78Ftpd21HmNSHHi6hwYS
Generated by Claude Code
Summary by Sourcery
Improve production deployment reliability and configuration visibility for Stripe, email, and Render-based deployments.
Bug Fixes:
Enhancements:
Documentation: