Root cause: The redirect rule in /vercel.json was intercepting ALL requests (including /api/*) before they reached the Next.js app, causing API routes to timeout without generating any logs. Changes: - Move www → non-www redirect to apps/web/next.config.ts async redirects() - Remove redirects array from root vercel.json - Keep cron job configuration in root vercel.json Why this fixes the issue: - Next.js handles redirects AFTER route resolution (pages vs API routes) - API routes execute before redirect logic is applied - Redirects still work for pages as expected - More idiomatic for Next.js applications Testing: - API routes should now respond: /api/health, /api/tools - www.tpmjs.com should still redirect to tpmjs.com - All existing functionality preserved 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
23 lines
503 B
TypeScript
23 lines
503 B
TypeScript
import type { NextConfig } from 'next';
|
|
|
|
const nextConfig: NextConfig = {
|
|
transpilePackages: ['@tpmjs/ui', '@tpmjs/utils', '@tpmjs/db', '@tpmjs/types', '@tpmjs/env'],
|
|
reactStrictMode: true,
|
|
async redirects() {
|
|
return [
|
|
{
|
|
source: '/:path*',
|
|
has: [
|
|
{
|
|
type: 'host',
|
|
value: 'www.tpmjs.com',
|
|
},
|
|
],
|
|
destination: 'https://tpmjs.com/:path*',
|
|
permanent: true,
|
|
},
|
|
];
|
|
},
|
|
};
|
|
|
|
export default nextConfig;
|