Fix syntax error in contact API route breaking Vercel build#1
Draft
sahaib wants to merge 2 commits into
Draft
Conversation
- Remove stray closing paren on the msg object literal (the build-breaking syntax error) - Destructure recaptchaToken from the request body (was referenced but undefined) - Actually send the composed message via sendEmail(msg)
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
lib/sendgrid threw at module import when SENDGRID_API_KEY was unset, which crashed Next.js build-time page-data collection for /api/contact on Vercel. Defer the key configuration (and the missing-key error) to the first sendEmail call so the build no longer depends on the env var being present.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Vercel build failed with a syntax error in
app/api/contact/route.ts:Cause
The
msgobject literal was being closed with})instead of}— a stray closing parenthesis left over from a previous refactor, which broke the parser. Two related bugs were also present:recaptchaTokenwas referenced in the reCAPTCHA verification body but never destructured from the request, so it was alwaysundefined.msgobject was composed but never actually sent (nosendEmailcall).Fix
)closing themsgobject literal (resolves the build break).recaptchaTokenfrom the request body.await sendEmail(msg).Merging this to
mainwill trigger the Vercel auto-deploy.Generated by Claude Code