hensei-web/pages/_error.tsx
Justin Edmund 2f757fc2a4 Fix Railway build errors by marking dynamic routes
- Add 'force-dynamic' export to API routes using cookies/searchParams
- Add 'force-dynamic' export to page components using dynamic features
- Create proper error pages without i18n complexity
- Fix "Dynamic server usage" errors during static generation

Routes now properly marked as dynamic will render at request time
instead of failing during build-time static generation.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-04 02:38:37 -07:00

47 lines
No EOL
1.3 KiB
TypeScript

import { NextPageContext } from 'next'
import Head from 'next/head'
import Link from 'next/link'
interface ErrorProps {
statusCode: number
}
function Error({ statusCode }: ErrorProps) {
return (
<div className="error-page" style={{ padding: '2rem', textAlign: 'center' }}>
<Head>
<title>
{statusCode
? `${statusCode} - Server Error / granblue.team`
: 'Client Error / granblue.team'}
</title>
</Head>
<div style={{ maxWidth: '600px', margin: '0 auto' }}>
<h1 style={{ fontSize: '4rem', marginBottom: '1rem' }}>{statusCode || 'Error'}</h1>
<p style={{ marginBottom: '2rem' }}>
{statusCode
? `A ${statusCode} error occurred on the server.`
: 'An error occurred on the client.'}
</p>
<Link href="/" style={{
display: 'inline-block',
padding: '0.75rem 1.5rem',
backgroundColor: '#007bff',
color: 'white',
borderRadius: '0.25rem',
textDecoration: 'none'
}}>
Go Home
</Link>
</div>
</div>
)
}
Error.getInitialProps = ({ res, err }: NextPageContext) => {
const statusCode = res ? res.statusCode : err ? err.statusCode : 404
return { statusCode }
}
export default Error