fix: Improve API initialization with lazy Supabase client and validation

- Move Supabase/Stripe initialization inside GET/POST handlers for lazy loading
- Add validation for missing environment variables in runtime
- Improve error handling in payment intent creation
- Clean up next.config.js environment variable configuration

This fixes potential build-time failures when environment variables are not available
during static generation.
This commit is contained in:
Marco Gallegos
2026-01-18 22:51:45 -06:00
parent c220e7f30f
commit f6832c1e29
4 changed files with 30 additions and 22 deletions

View File

@@ -14,7 +14,7 @@ const nextConfig = {
{
protocol: 'https',
hostname: '**.supabase.co',
},
}
],
},
env: {
@@ -23,4 +23,7 @@ const nextConfig = {
},
compiler: {
removeConsole: false, // Temporarily enable logs for debugging 500 errors
module.exports = nextConfig
}
}
module.exports = nextConfig