8b7cc15362
ci/woodpecker/push/woodpecker Pipeline failed
The real root cause of CI build failures was NOT Turbopack, but Resend initialization at module level without API key. Problem: - Resend was initialized at module level: const resend = new Resend(process.env.RESEND_API_KEY) - During build, Next.js collects page data and imports all modules - If RESEND_API_KEY is not set, Resend throws error: 'Missing API key' - This caused build to fail with 'Failed to collect page data for /api/contact' Solution: - Implement lazy initialization pattern for Resend - Only initialize Resend when actually needed (when sending emails) - Add proper error handling if API key is missing Changes: - src/app/api/contact/route.ts: Add getResend() function with lazy init - src/app/(marketing)/contact/actions.ts: Add getResend() function with lazy init This allows the build to succeed even without RESEND_API_KEY in CI, while still requiring it at runtime when actually sending emails.