Skip to content

fix(aws-node-nextjs-web-app): update next to a patched release and add a live test - #840

Merged
czubocha merged 1 commit into
v4from
branch/dreamy-lamport-709whe-nextjs
Nov 25, 2026
Merged

czubocha merged 1 commit into
v4from
branch/dreamy-lamport-709whe-nextjs

Conversation

@czubocha

Copy link
Copy Markdown
Contributor

Lesson

A Next.js app runs on AWS Lambda Web Functions from the standalone server that next build writes: one webApps entry ships .next/standalone/ as it is (build: false), and the same server serves pages, route handlers and the static assets the build script copies in. No adapter, no handler.

Left out on purpose: custom domains, a CDN or S3 for static assets, IAM-authorized endpoints, image optimization settings, environment variables and VPC access. The docs page and the Next steps links cover them.

Changes

  • package.json / package-lock.json: next pinned to 16.4.6, the latest 16.x release (the lockfile had 16.4.0; 16.4.6 is the patched release); react and react-dom pinned to 19.3.1, the current release (the checker's exact-version rule). npm audit (dev dependencies included): 0 vulnerabilities.
  • example.json (new): manifest with the title and description the gallery already shows, and a fast live test with two http checks on the stack output SiteWebFunctionUrl: /api/hello must answer 200 with Hello from a Next.js route handler!, and /lambda.svg must answer 200 with the image's fill="#fd5750", which is only there when the build script copied public/ into the standalone output.
  • test/prepare.mjs (new): runs npm run build after npm ci and before the deploy, as the README's Deploy section does. The runner copies the example without a build, so the deploy depends on it.
  • README.md: restructured into the standard sections (What it deploys, Prerequisites, Deploy, Try it, How it works, Cost and cleanup, Next steps); the local run, Dev Mode and logs sections are H3s under How it works; the two relative links are absolute; output pasted from a run with Framework 4.47.0 and Next.js 16.4.6; Try it runs the requests the checks assert; Cost names what is billed, with pricing links. Frontmatter and badge line regenerated by npm run docs.

serverless.yml, next.config.mjs and app/ are unchanged. The example is not an onboarding example.

Test plan

us-east-1, Framework 4.47.0.

  • Live test on the committed files: PASS aws-node-nextjs-web-app 4.47.0 109s (stage exontpwe7nk), both checks passed.
  • Negative control (scratch copy, the first check's contains changed to Hello from not-Next.js!): FAIL zz-neg-next 4.47.0 195s at the check step, expected status 200 and a body containing "Hello from not-Next.js!"; ... the last response was status 200, body "{\"message\":\"Hello from a Next.js route handler!\",...}". The prepare step built the app and the deploy succeeded first.
  • README followed by hand from a clean copy: npm install, npm run build, serverless deploy, curl on /api/hello, /lambda.svg, / and its CSS file, serverless invoke --web-app site --path /api/hello, serverless info --verbose (shows SiteWebFunctionUrl), serverless logs --web-app site, npm start locally, serverless remove. All matched the README. serverless dev was not run; that section is unchanged apart from its heading level.
  • Fresh-agent test: an agent given only the README deployed the example, ran Try it (/api/hello, lambda.svg, the page and its CSS file answered 200; serverless invoke --web-app site --path /api/hello printed HTTP 200 OK and the route handler's body), removed it and confirmed the stack and log groups were gone.
  • Nothing left after the runs: no stack, log group, IAM role, deployment-bucket objects or web function from the example.
  • npm test (323 pass), npm run validate (0 errors), node scripts/check-examples.mjs aws-node-nextjs-web-app (0 errors), npm run check-docs clean. check-examples.mjs --package stops with No file matches include / exclude patterns, because it packages without running test.prepare, so .next/standalone/ does not exist; the live test covers packaging.

Generated by Claude Code

@czubocha
czubocha merged commit 1b405fb into v4 Nov 25, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant