Build Failures
TypeScript Errors During Build
Symptom: Build fails with TypeScript errors despiteignoreBuildErrors: true.
Cause: While the Next.js config ignores build errors, Vercel may still fail if there are critical type issues.
Solution: Run Type Check Locally
Solution: Run Type Check Locally
tsc --noEmit to check for type errors without emitting files.Fix any critical errors, especially:- Missing return types in API routes
- Incorrect prop types in components
- Invalid module imports
Solution: Check Next.js Config
Solution: Check Next.js Config
Verify your
next.config.ts includes:next.config.ts
Dependency Installation Failures
Symptom:npm install fails during Vercel deployment.
Common causes:
Argument Cartographer requires Node.js 18+ due to Next.js 15 and modern ES modules.
Build Timeout on Vercel
Symptom: Build exceeds Vercel’s time limit (45 minutes on Hobby, configurable on Pro). Solutions:-
Optimize build process:
package.json
-
Check for slow dependencies:
- Upgrade to Vercel Pro if your project legitimately requires longer build times.
Authentication Issues
Firebase Authentication Not Initializing
Symptom: Users can’t sign in, or see “Firebase not initialized” errors.1
Verify Environment Variables
Check all
NEXT_PUBLIC_FIREBASE_* variables are set in Vercel:2
Check Authorized Domains
In Firebase Console:
- Go to Authentication → Settings → Authorized domains
- Add your Vercel domain (e.g.,
your-app.vercel.app) - Add custom domain if applicable
3
Verify Firebase Config Format
The config must match Firebase Console exactly:
src/firebase/config.ts
Permission Denied Errors
Symptom:Missing or insufficient permissions when accessing Firestore.
The application implements strict security rules. The custom error handler provides detailed debugging:
User ID Mismatch
User ID Mismatch
Problem: User trying to access another user’s data.In the example above,
auth.uid is user123 but the path contains user456.Solution: Ensure all Firestore paths use the authenticated user’s UID:Missing userId Field
Missing userId Field
Problem: Document doesn’t have required Solution: Include
userId field on creation.Security rules validate:userId in all documents:Not Authenticated
Not Authenticated
Problem: User is not signed in.The error will show
"auth": null.Solution: Ensure user is authenticated before accessing Firestore:API Integration Issues
Firecrawl API Failures
Symptom: Analysis fails with “Firecrawl API key not configured” or “Web Search failed”.1
Verify API Key
Check the environment variable:The application validates:
2
Check API Credits
Firecrawl has usage limits. Log in to Firecrawl Dashboard to check:
- Remaining credits
- Rate limit status
- Recent API calls
3
Monitor Fallback Behavior
The application has built-in fallbacks when Firecrawl fails:Check Vercel logs for these warnings to understand which fallback was triggered.
Twitter API Errors
Symptom: Social Pulse feature returns empty or fails with 401/403 errors.Invalid Bearer Token
Invalid Bearer Token
Error:
Twitter API request failed with status 401Solution:- Verify token in Twitter Developer Portal
- Regenerate bearer token if expired
- Update
TWITTER_BEARER_TOKENin Vercel environment variables - Redeploy application
Rate Limit Exceeded
Rate Limit Exceeded
Error:
Twitter API request failed with status 429Twitter API v2 rate limits:- Basic tier: 500,000 tweets/month
- Search endpoint: 180 requests per 15 minutes
- Wait for rate limit reset (check
x-rate-limit-resetheader) - Upgrade Twitter API tier
- Implement caching for frequently searched topics
Non-Fatal Failures
Non-Fatal Failures
Twitter failures are non-fatal by design:The analysis completes successfully with empty
tweets array and no socialPulse summary.Google Gemini API Issues
Symptom: Analysis fails with “AI failed to generate” errors.1
Verify API Key
2
Check API Quotas
Gemini API has rate limits:
- Free tier: 15 requests per minute
- Paid tier: Higher limits based on plan
3
Review Error Messages
Common errors:Safety filters triggered:Solution: Rephrase input query to avoid triggering content filters.Token limit exceeded:Solution: The app limits scraped content to 20,000 chars per source. If still failing, reduce number of sources.
Runtime Errors
JSON Parsing Failures
Symptom: “Failed to parse JSON from AI response” errors. The application uses JSON5 for lenient parsing, but AI responses sometimes have malformed JSON.Diagnosis
Diagnosis
Check Vercel logs for:This logs the actual AI response for debugging.
Common Causes
Common Causes
- AI returned text instead of JSON:
- AI didn’t wrap response in ```json code block
- Response is markdown or natural language
- Malformed JSON:
- Trailing commas
- Single quotes instead of double quotes
- Unescaped special characters
- Response truncated:
- AI hit token limit mid-response
- Network error during streaming
Recovery Strategy
Recovery Strategy
The app attempts multiple parsing strategies:If all fail, the error is thrown with the raw text for debugging.
Missing or Invalid Credibility Score
Symptom: Credibility score is 0, NaN, or outside 1-10 range. The application automatically fixes this:credibilityScore field at all.
Null Source URIs
Symptom: Argument nodes havesource: "null" instead of valid URLs.
Automatic fix applied:
Performance Issues
See the dedicated Performance Troubleshooting guide for:- Slow analysis generation
- High API costs
- Firestore optimization
- Caching strategies
Getting Help
1
Check Vercel Logs
Vercel Dashboard → Deployments → Select deployment → Function logsLook for:
- Error stack traces
- Console warnings
- Performance metrics
2
Enable Debug Logging
The application includes extensive console logging:These help trace the exact point of failure.
3
Test Locally
Reproduce the issue locally:Check terminal output for detailed error messages not visible in production.
4
Review Firebase Rules
Test security rules in Firebase Console:Firestore Database → Rules → Rules Playground
Next Steps
API Errors
Detailed API error troubleshooting
Performance
Optimize application performance
Environment Variables
Review configuration requirements
Firebase Setup
Verify Firebase configuration
