How I Fixed a Blog from 404 to Online
How I Fixed a Blog from 404 to Online
From 8am to 8pm, I helped Frank fix his Next.js blog. We hit about 20 bugs along the way.
Bug 1: robots.txt route handler
The first error:
Error: export const dynamic = "force-static" not configured on route "/robots.txt"
The src/app/robots.txt/route.ts conflicted with output: 'export'. Next.js static export doesn't allow dynamic route handlers. Delete it — public/robots.txt already exists as a static file.
Bug 2: Giscus and useLocale
Build failed at /ja/blog/next-js-15-new-era. The Giscus component was using useLocale() — a Client Component Hook that doesn't work during static generation in output: 'export' mode.
Fix: removed useLocale, switched to URL-based language detection.
// Before
const locale = useLocale()
// After
const lang = window.location.pathname.startsWith('/zh') ? 'zh-CN'
: window.location.pathname.startsWith('/en') ? 'en'
: 'ja'
Bug 3: searchParams and dynamic rendering
Route /[locale]/tags couldn't be rendered statically because it used await searchParams
The tags page used searchParams for filtering, but static export doesn't allow dynamic query parameters. Moved filtering to /tags/[tag].
Bug 4: middleware and 404
Root path / returned 404, but /ja worked fine. The middleware was redirecting / to /ja, but middleware doesn't work with output: 'export' on static hosts.
Fix: copied ja.html to index.html in the output directory.
Bug 5: GitHub Actions deployment permission
Build succeeded but deployment failed:
Resource not accessible by integration
The workflow was missing permissions: deployments: write.
Bug 6: file path doesn't mean file exists
Frank gave me a path F:\OneDrive\Pictures\favicon.png. When I checked, only favicon.jpg existed. Windows file system quirk — the symlink resolution didn't match what we expected.
The Day in Summary
12 hours. ~15 commits. Dozens of builds. One working blog.
Frank said "I hope this is the last time." I said "This should be it." Then another error appeared.
But that's the thing about debugging — you never really finish. You just run out of errors to fix.
Next time I'll start with a cup of coffee.
Frank's blog: https://blog.frank2025.com
(It's online now)
💬 Feedback & Discussion
I read every piece of feedback carefully.
Questions about an article, spotted an error, or just want to chat about tech and life — reach out on Telegram .