Fix build issues and end-to-end tests using adapter api for aws#10
Merged
Fix build issues and end-to-end tests using adapter api for aws#10
Conversation
081ed77 to
99d1275
Compare
commit: |
There was a problem hiding this comment.
Pull request overview
This PR updates the AWS build/test setup to use the Next.js adapter API outputs (instead of the legacy NextServer-based runtime path) and bumps dependencies to address build and routing/test failures, with additional local E2E workflow wiring.
Changes:
- Bump AWS Next.js catalog version to
16.1.4and refresh lockfile (incl. Playwright/Express-related updates). - Introduce
ResolvedRoute.isFallbackand filter out prerenderedfallback: falsedynamic routes during routing to correctly produce 404s. - Shift the request/runtime path toward the adapter handler flow and update build/copy/plugin logic to support adapter outputs and monorepo
packagePath.
Reviewed changes
Copilot reviewed 51 out of 52 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-workspace.yaml | Bumps AWS catalog Next.js version to 16.1.4. |
| pnpm-lock.yaml | Lockfile refresh for Next/Playwright/Express and transitive updates. |
| packages/tests-unit/tests/core/routing/routeMatcher.test.ts | Adds unit coverage for isFallback and fallback-false dynamic route matching. |
| packages/tests-unit/tests/core/routing/matcher.test.ts | Updates config mock to include PrerenderManifest shape. |
| packages/tests-unit/tests/adapters/cache.test.ts | Updates expected ResolvedRoute shape with isFallback. |
| packages/tests-e2e/tests/pagesRouter/header.test.ts | Adjusts header assertions (currently comments out x-powered-by). |
| packages/tests-e2e/tests/pagesRouter/fallback.test.ts | Skips a fallback E2E test due to cache interception limitations. |
| packages/tests-e2e/tests/appRouter/sse.test.ts | Skips SSE E2E test due to runtime crash. |
| packages/tests-e2e/tests/appRouter/revalidateTag.test.ts | Changes cache-header expectations post revalidate-tag. |
| packages/tests-e2e/tests/appRouter/isr.revalidate.test.ts | Skips ISR revalidate E2E test. |
| packages/tests-e2e/tests/appRouter/dynamic.catch-all.hypen.test.ts | Skips dynamic catch-all hyphen E2E test. |
| packages/tests-e2e/tests/appRouter/config.redirect.test.ts | Skips redirect encoding-related E2E tests. |
| packages/tests-e2e/tests/appPagesRouter/api.test.ts | Skips client API-call E2E test due to adapter import issue. |
| packages/tests-e2e/playwright.config.js | Comments out the experimental Playwright project. |
| packages/tests-e2e/package.json | Switches Playwright dependency to catalog:. |
| packages/open-next/src/utils/promise.ts | Changes detached promise handling/logging behavior. |
| packages/open-next/src/types/open-next.ts | Adds ResolvedRoute.isFallback to the public type. |
| packages/open-next/src/types/global.ts | Disables __next_route_preloader global typing (commented out). |
| packages/open-next/src/plugins/inlineRouteHandlers.ts | Adds packagePath support when collecting/inlining chunks; updates external chunks plugin signature. |
| packages/open-next/src/overrides/wrappers/express-dev.ts | Fixes Express catch-all route matching pattern. |
| packages/open-next/src/overrides/wrappers/aws-lambda-streaming.ts | Disables route preloader invocation on warmer events (commented out). |
| packages/open-next/src/core/util.ts | Removes legacy NextServer-based util implementation. |
| packages/open-next/src/core/util.adapter.ts | Removes adapter-specific util shim (no longer used). |
| packages/open-next/src/core/routingHandler.ts | Recomputes post-rewrite matches and filters fallback-false dynamic routes before deciding 404. |
| packages/open-next/src/core/routing/routeMatcher.ts | Adds prerender fallback-false detection and isFallback on resolved routes. |
| packages/open-next/src/core/routing/adapterHandler.ts | Adds explicit 404/500 handling + waitUntil plumbing in adapter handler. |
| packages/open-next/src/core/requestHandler.ts | Routes through adapterHandler, removes legacy processRequest path, sets explicit status codes for /404 and /500. |
| packages/open-next/src/core/createMainHandler.ts | Disables route preloader on start (commented out). |
| packages/open-next/src/build/createServerBundle.ts | Adjusts adapter output copy path handling; removes util override plugin usage. |
| packages/open-next/src/build/createAssets.ts | Fixes .next path selection when using adapter outputs. |
| packages/open-next/src/build/copyAdapterFiles.ts | Adds packagePath param; supports copying middleware output; updates output paths. |
| packages/open-next/src/build.ts | Enables adapter outputs via NEXT_ADAPTER_PATH and early-returns (delegate artifact generation to adapter). |
| packages/open-next/src/adapters/middleware.ts | Updates ResolvedRoute shape to include isFallback. |
| packages/open-next/src/adapters/cache.ts | Guards openNextConfig access and updates ResolvedRoute shape. |
| packages/open-next/src/adapter.ts | Adds packagePath handling, cache file placement updates, and passes packagePath to plugins. |
| packages/open-next/package.json | Bumps Express and @types/express. |
| packages/cloudflare/src/cli/build/open-next/createServerBundle.ts | Passes packagePath into adapter file copying. |
| packages/cloudflare/src/cli/adapter.ts | Passes packagePath into inline route handler plugin. |
| examples/pages-router/src/pages/sse/index.tsx | Removes "use client" and adds getStaticProps; renames component. |
| examples/pages-router/package.json | Simplifies local build scripts and adjusts env for local start. |
| examples/pages-router/open-next.config.ts | Switches example to local dev overrides and enables useAdapterOutputs + cache interception. |
| examples/pages-router/open-next.config.local.ts | Removes separate local config file. |
| examples/pages-router/next.config.ts | Tweaks rewrite source to include trailing slash. |
| examples/experimental/package.json | Removes local build scripts. |
| examples/app-router/package.json | Removes local build script variant. |
| examples/app-router/open-next.config.ts | Switches to local dev overrides; enables adapter outputs + cache interception; adds imageOptimization overrides. |
| examples/app-router/open-next.config.local.ts | Removes separate local config file. |
| examples/app-pages-router/package.json | Simplifies local build script; adds Express deps/types for proxy dev flow. |
| examples/app-pages-router/open-next.config.ts | Consolidates dev overrides; enables adapter outputs + cache interception; adds imageOptimization overrides. |
| examples/app-pages-router/open-next.config.local.ts | Removes separate local config file. |
| examples/app-pages-router/on-proxy.ts | Adjusts proxy routing patterns and env vars for spawned servers. |
| .github/workflows/local.yml | Adds local E2E workflow to build/run examples and execute Playwright tests. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)
packages/open-next/src/core/routing/adapterHandler.ts:39
- In the route loop, returning when getHandler(route) is undefined aborts routing entirely and bypasses the final 404 handling. This can lead to requests never being handled if the first resolvedRoute isn't inlined. Replace the early return with a continue (and only return after a handler successfully runs or after the loop finishes).
for (const route of routingResult.resolvedRoutes) {
const module = getHandler(route);
if (!module || resolved) {
return;
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For aws :
This PR already includes a bunch of changes, and I think it would make sense to first merge this one and fix and probably refactor cloudflare ones in another PR