A tool to help Granblue Fantasy players create and share teams and strategies.
Find a file
Justin Edmund 1f8de7ee30
Fix Railway build errors by marking dynamic routes (#437)
## Summary
- Fixes Railway deployment build failures caused by dynamic server usage
errors
- Marks routes that use runtime features as `force-dynamic` to prevent
static generation attempts
- Creates proper error pages to handle 404/500 scenarios

## Problem
The build was failing with "Dynamic server usage" errors because Next.js
was trying to statically generate pages that use runtime features like:
- `cookies()` for authentication
- `searchParams` for filtering
- Dynamic data fetching that requires request-time context

## Solution
Added `export const dynamic = 'force-dynamic'` to:

### API Routes
- `/api/jobs/route.ts` - uses searchParams
- `/api/jobs/skills/route.ts` - uses cookies via fetchFromApi
- `/api/version/route.ts` - uses cookies via fetchFromApi
- `/api/raids/groups/route.ts` - uses cookies via fetchFromApi
- `/api/parties/route.ts` - uses searchParams and cookies
- `/api/parties/[shortcode]/route.ts` - uses cookies
- `/api/parties/[shortcode]/remix/route.ts` - uses cookies

### Page Components
- `/app/[locale]/teams/page.tsx` - uses searchParams
- `/app/[locale]/new/page.tsx` - fetches dynamic data
- `/app/[locale]/saved/page.tsx` - uses cookies and searchParams
- Additional pages to avoid useContext errors during static generation

### Error Handling
- Created `/pages/_error.tsx` - Simple error page without i18n
complexity
- Created `/app/not-found.tsx` - App Router 404 page

## Test plan
- [x] Build completes successfully locally with `npm run build`
- [ ] Deploy to Railway staging environment
- [ ] Verify all dynamic routes work correctly
- [ ] Check error pages display properly

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

Co-authored-by: Claude <noreply@anthropic.com>
2025-09-04 02:41:03 -07:00
.storybook Deploy organization and bug fixes (#299) 2023-04-12 06:37:41 -07:00
.vscode Break collection pages into hooks (#414) 2024-04-21 00:46:04 -07:00
app Fix Railway build errors by marking dynamic routes (#437) 2025-09-04 02:41:03 -07:00
components Fix TypeScript errors for production build (#436) 2025-09-04 01:47:10 -07:00
data February 2024 updates and bug fixes (#407) 2024-02-21 23:18:53 -05:00
extensions Fix TypeScript errors for production build (#436) 2025-09-04 01:47:10 -07:00
hooks Further GridRep and Collection fixes (#417) 2024-04-23 05:11:23 -07:00
i18n Fix TypeScript errors for production build (#436) 2025-09-04 01:47:10 -07:00
pages Fix Railway build errors by marking dynamic routes (#437) 2025-09-04 02:41:03 -07:00
public Remove images that were accidentally committed (#434) 2025-09-03 23:16:30 -07:00
scripts Fix TypeScript errors for production build (#436) 2025-09-04 01:47:10 -07:00
styles Fix intermittent crash: bounded caching + HTTP timeouts/keepAlive + preview route dedupe (#428) 2025-08-31 12:16:42 -07:00
supervisord Fix intermittent crash: bounded caching + HTTP timeouts/keepAlive + preview route dedupe (#428) 2025-08-31 12:16:42 -07:00
types Fix i18n migration to next-intl (#430) 2025-09-03 16:25:59 -07:00
utils Fix i18n migration to next-intl (#430) 2025-09-03 16:25:59 -07:00
.aidigestignore Jedmund/image embeds 2 (#424) 2025-02-09 22:54:15 -08:00
.env.local Fix i18n migration to next-intl (#430) 2025-09-03 16:25:59 -07:00
.env.sample February 2023 Update (#158) 2023-02-04 23:46:24 -08:00
.eslintrc.json Deploy organization and bug fixes (#299) 2023-04-12 06:37:41 -07:00
.gitignore Remove images that were accidentally committed (#434) 2025-09-03 23:16:30 -07:00
.mise.toml Fix TypeScript errors for production build (#436) 2025-09-04 01:47:10 -07:00
.nvmrc Fix TypeScript errors for production build (#436) 2025-09-04 01:47:10 -07:00
.prettierignore Add prettierignore 2022-12-04 07:18:59 -08:00
.prettierrc Remove trailing semicolons 2022-12-05 17:54:46 -08:00
CLAUDE.md Fix intermittent crash: bounded caching + HTTP timeouts/keepAlive + preview route dedupe (#428) 2025-08-31 12:16:42 -07:00
i18n.config.ts Fix i18n migration to next-intl (#430) 2025-09-03 16:25:59 -07:00
middleware.ts Fix TypeScript errors for production build (#436) 2025-09-04 01:47:10 -07:00
mise.toml Fix intermittent crash: bounded caching + HTTP timeouts/keepAlive + preview route dedupe (#428) 2025-08-31 12:16:42 -07:00
next-env.d.ts Fix i18n migration to next-intl (#430) 2025-09-03 16:25:59 -07:00
next-i18next.config.js Update next-i18next.config.js 2022-03-05 02:29:50 -08:00
next.config.js Fix i18n migration to next-intl (#430) 2025-09-03 16:25:59 -07:00
package-lock.json Fix i18n migration to next-intl (#430) 2025-09-03 16:25:59 -07:00
package.json Fix TypeScript errors for production build (#436) 2025-09-04 01:47:10 -07:00
README.md July 2023 Feature Release: Rich text editor and support for tagging objects (#340) (#341) 2023-07-05 21:51:30 -07:00
README.png February 2023 Update (#158) 2023-02-04 23:46:24 -08:00
tsconfig.json Fix intermittent crash: bounded caching + HTTP timeouts/keepAlive + preview route dedupe (#428) 2025-08-31 12:16:42 -07:00
tslint.json Create tslint.json 2022-01-28 23:19:31 -08:00

Header image for hensei-web

hensei-web

hensei-web is the frontend for granblue.team, an app for saving and sharing teams for Granblue Fantasy.

Getting Started

First, you have to set up your environment file. You should start with .env.sample, but here are some gotchas:

App URLs

Don't add a trailing slash to these URLs! The API will run on port 3000 by default, but make sure to change these to match your instance of the API.

NEXT_PUBLIC_SIERO_API_URL='http://127.0.0.1:3000/api/v1'
NEXT_PUBLIC_SIERO_OAUTH_URL='http://127.0.0.1:3000/oauth'

Asset URLs

Next.js serves all assets out of the /public directory. In development we utilize this for all assets, but in production, you will want to host these images on a cloud storage provider like Amazon S3. Once you have that set up and you're running in a production environment, change this to the full bucket URL.

NEXT_PUBLIC_SIERO_IMG_URL='/images'

Dependencies

Once your .env is all set up, install all dependencies:

npm install
# or
yarn install

Then, run the development server with:

npm run dev
# or
yarn dev

Assets

The hensei-api repository has tasks that will help you get assets, although some were crafted or renamed by hand. The front-end expects this folder structure inside of the images folder:

root
├─ accessory-grid/
├─ accessory-square/
├─ awakening/
├─ ax/
├─ character-main/
├─ character-grid/
├─ character-square/
├─ guidebooks/
├─ jobs/
├─ job-icons/
├─ job-portraits/
├─ job-skills/
├─ labels/
├─ mastery/
├─ placeholders/
├─ raids/
├─ summon-main/
├─ summon-grid/
├─ summon-square/
├─ updates/
├─ weapon-main/
├─ weapon-grid/
├─ weapon-keys/
├─ weapon-square/