
The Deployed App That Did Nothing: A Next.js Static Export Story
By Nandkishor Tamkhade — Team NxtTech Why a perfectly-rendered frontend can have dead buttons, and how I learned that Next.js static export and dynamic routes don't get along.
The Worst Kind of Bug
On day four of the AWS First Commit hackathon, we deployed. The build succeeded. Amplify gave us a URL. I opened it, and the app looked beautiful.
The saffron header. The language chips for English, हिंदी, मराठी. The upload box with the camera icon. The "Find My Problem" button, right where it should be. Weeks of design choices, four days of build, all rendered on a live production URL.
And then I clicked the button.
Nothing.
I clicked the language switcher. Nothing. I clicked "Try Live Demo." Nothing. I clicked on the app name in the header — which I had wired up to navigate home — nothing.
The app looked alive. The app was dead.
This is the story of finding that bug, understanding why it happened, and the two small changes that brought the app back from the dead. If you're deploying a Next.js app to Amplify, S3, or any static host, this bug will find you eventually. It's worth understanding before it does.
The Investigation
I opened the browser DevTools and went straight to the Console tab. Red errors filled the screen:
GET https://main.d28q0w9q60odl9.amplifyapp.com/_next/static/chunks/27t_qfc-3_lzs.js 404 (Not Found)
GET https://main.d28q0w9q60odl9.amplifyapp.com/_next/static/chunks/1f0m_nyksetzr.js 404 (Not Found)
GET https://main.d28q0w9q60odl9.amplifyapp.com/_next/static/chunks/0kcxqu7bgail1.css 404 (Not Found)
GET https://main.d28q0w9q60odl9.amplifyapp.com/_next/static/media/fb34704f4f4f68ab-s.p.3giajfo5uv2ys.woff2 404 (Not Found)The JavaScript was missing.
The HTML loaded. The CSS loaded. The fonts tried to load and failed. But the JavaScript files — the ones that make a React app actually do things — were not where the browser expected them to be.
This is why the buttons were dead. In a React app, clicking a button doesn't trigger an HTTP request to the server. It triggers a JavaScript function that was attached to that button when the app "hydrated" in the browser. Hydration is the process where React takes over the server-rendered HTML and wires up all the interactive behavior.
If the JavaScript never loads, hydration never happens. What you see is not an app. It's a screenshot. Beautiful, static, dead.
Why the JavaScript Was Missing
Amplify was serving the HTML from the wrong place. The HTML file
index.html referenced JavaScript at /_next/static/chunks/... . The browser requested those paths. Amplify looked for files at those paths. Found nothing. Returned 404.The root cause: our initial deployment had been done via a manual CLI upload of the wrong artifact.
We had run
npm run build , which produces an out/ folder. We then zipped that folder and uploaded it. But we zipped the folder itself, not its contents. So Amplify's web root contained a single folder named out/ . Inside that folder, the _next/ directory existed. But the browser was asking for /_next/... at the web root, not /out/_next/... .It's a one-line mistake in the deployment command. It costs hours to find.
The lesson: never manually upload build artifacts to a hosting service. Let the hosting service build from source.
The Fix, Part One: Let Amplify Build
The correct way to deploy a Next.js app to Amplify is to connect it to a Git repository and let Amplify run the build itself.
We already had the code on GitHub. We just needed to tell Amplify to use it. The configuration lives in
amplify.yml at the repo root:version: 1
applications:
- appRoot: frontend
frontend:
phases:
preBuild:
commands:
- npm ci
build:
commands:
- npm run build
artifacts:
baseDirectory: out
files:
- '**/*'
cache:
paths:
- node_modules/**/*Three things matter here:
1.
appRoot: frontend — our Next.js app lives in a frontend/ subfolder, not at the repo root. Amplify needs to know this, or it will try to run npm run build at the top level and fail.2.
npm ci in preBuild — this installs dependencies from a locked package-lock.json . It's faster and more reproducible than npm install . For a production deploy, always prefer npm ci .3.
baseDirectory: out — Next.js with output: 'export' builds a static site to out/ . Amplify needs to serve from there.After this change, I pushed the config to GitHub, went into the Amplify console, clicked "Redeploy this version," and waited five minutes.
The build ran. The
_next folder was placed correctly. The buttons came alive.Half the bug was solved.
The Fix, Part Two: The Dynamic Route Problem
Now that JavaScript was loading, the app hydrated. But the status page broke with a different error:
Error: Page "/status/[caseId]/page" is missing param "/status/[caseId]"
in "generateStaticParams()", which is required with "output: export" config.This is a fundamental limitation of Next.js static export, and it trips up almost everyone who tries to combine the two.
Our status page had a dynamic route:
/status/[caseId] . When a user uploads a document and gets a case ID like abc-123 , they get redirected to /status/abc-123 . The page reads the case ID from the URL and fetches the corresponding data.In a server-rendered Next.js app, this works fine. Next.js handles dynamic routes by rendering them on the server when the request comes in.
In a statically-exported Next.js app, this is impossible. Static export means Next.js pre-renders all pages at build time and serves them as plain HTML. When the build runs, it needs to know every possible URL the app can serve. For a dynamic route, you tell it with
generateStaticParams() :export async function generateStaticParams() {
return [{ caseId: '1' }, { caseId: '2' }];
}But our case IDs are generated at runtime. We can't possibly know them at build time. There might be one. There might be ten thousand. The static export requirement is fundamentally incompatible with runtime-generated identifiers.
The fix: stop putting the case ID in the path. Put it in a query parameter.
Old URL:
/status/abc-123
New URL: /status?id=abc-123 A query string is not part of the path Next.js needs to pre-render. There's only one page —
/status — and it can render for any query parameter.Here's what the page looks like now:
'use client';
import { Suspense } from 'react';
import { useSearchParams } from 'next/navigation';
function StatusContent() {
const searchParams = useSearchParams();
const caseId = searchParams.get('id');
if (!caseId) {
return <div>No case ID provided. Please upload a document first.</div>;
}
// ... fetch and render case data
}
export default function Page() {
return (
<Suspense fallback={<div>Loading...</div>}>
<StatusContent />
</Suspense>
);
}Two things here are non-obvious:
useSearchParams() requires a Suspense boundary. Next.js 15 treats it as a dynamic function that must be wrapped. Without the <Suspense> wrapper, you get a prerender error at build time. This is a documented behavior, but it's not the kind of thing you find until you hit it.'use client' at the top. Query parameter reading happens in the browser, not at build time. The component must be a Client Component.After these changes, the build succeeded. The status page loaded. The whole flow worked end to end.
The other half of the bug was solved.
What I Actually Learned
Static export is not a compromise. It's a different architecture.
When I first chose
output: 'export' , I thought of it as "Next.js but simpler." That was wrong. Static export is a fundamentally different rendering model. It changes what URLs you can have, what data you can fetch at request time, and what features of Next.js you can use.The right mindset: if you're using static export, assume that every page must exist at build time. Design your URL structure around that constraint from the start.
Every dynamic route is a lie. If you find yourself wanting
/status/[id] , /case/[id] , or /user/[name] in a static-export Next.js app, stop. Ask yourself: could this be a query parameter? Most of the time, the answer is yes.Deployment configuration is code, and it deserves tests. We had never tested
amplify.yml . We wrote it, pushed it, and hoped. That cost us hours. Now I would write the config file, then do a throwaway deploy to a test branch, verify it worked, and only then promote it to main.
The Design Decisions Nobody Talks About
There's a second half to the story that doesn't show up in the error logs, and it matters more than the bug.
We weren't building for developers. We weren't building for people who know what a rejection letter looks like. We were building for a farmer in Maharashtra who has never used an app, whose primary phone is a ₹6,000 Android device, and who reads Hindi or Marathi but not English.
Every design decision had to survive that reality.
Trilingual from the first render. The language switcher isn't hidden in a menu. It's in the header, always visible, with three buttons: English, हिंदी, मराठी. When the user picks a language, the entire UI switches — including the diagnosis text and the correction form.
Noto Sans for everything. This font supports Devanagari and Latin scripts in the same typeface. Using two fonts would have broken the visual rhythm whenever Hindi and English appeared together on the same page. Noto Sans keeps the layout stable across scripts.
Minimum 16px body text. Not 14px. Not 13px. On a small phone with a tired user, 16px is the floor. Smaller text is unreadable.
48×48 pixel tap targets. Every button, every link, every toggle. The average fingertip is more precise than the average developer assumes, but not by much. Designing for shaky hands is not hard — it just requires thinking about it.
No color-only communication. When a case is "Diagnosed," it's not just a green dot. It's a green dot, a text label that says "Diagnosed," and an icon. A user who cannot distinguish red from green — which is roughly 1 in 12 men in India — can still use the app.
The "Try Live Demo" button. We added this on day three. It pre-fills a sample case with one tap. If a judge wants to test the app, they don't have to find a rejection letter. If a user wants to see how it works, they don't have to upload their own document first. This one button changed how people experienced the app. Judges who would have spent two minutes figuring out what to upload instead clicked one button and saw the entire flow in thirty seconds.
None of these decisions are technically sophisticated. They're all things any UX designer would tell you. But in a hackathon where every hour counts, it's easy to skip them. The temptation is to build the happy path and move on.
We didn't skip them. And that's what made the app feel like a product instead of a prototype.
What I Would Do Differently
1. Test the deployed URL on day one, not day four. We built a lot of features before verifying that the deployment pipeline worked end to end. If we had deployed a "hello world" page on day one and verified that buttons worked on the live URL, we would have caught the static export issue immediately — and had four days to design around it.
2. Read the Next.js static export documentation before choosing it. The limitations are documented. I just didn't read them carefully enough. Two hours of reading would have saved six hours of debugging.
3. Build the deployment config first, then the features. The
amplify.yml file should have been the very first thing we wrote. Instead we wrote it on day four, in a panic, after the deployment failed twice.4. Design for the least technical user from the first screen. We got there eventually, but it took three iterations. If I had started by asking "What does this look like to a farmer in Parner Taluka?", every screen would have been designed correctly the first time.
The Two-Line Version
If you take nothing else from this post, take these two rules:
1. Never manually upload a Next.js build. Let Amplify (or Vercel, or Netlify) build from source. Manual upload will get the folder structure wrong eventually.
2. If you're using Next.js static export, no dynamic routes. Use query parameters instead.
Both rules cost us hours to learn. Both rules are worth knowing before you start.
Try It
Click "Try Live Demo (PM-KISAN Rejection)" on the home page. It runs the entire pipeline in under a minute. Change the language. Click the header. Follow the status tracker. Everything works, on every phone I've tested.
The Amplify config is at
amplify.yml . The status page is at frontend/app/status/page.tsx . The trilingual strings are inline in the components — for production I would move them to a proper i18n library, but for a four-day build, keeping them close to the UI made iteration faster.
Team NxtTech — Suraj Khanase (Lead), Sumit Jagtap, Nandkishor Tamkhade, Tejas Shinde
Built at AWS First Commit — Bharat Builds Tour, Event 01, September 2026.
If you're building civic tech or deploying Next.js to Amplify and hitting the same problems, reach out through the GitHub repo. I'd love to hear how you solved them.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article