Skip to content

Conversation

@conico974
Copy link
Contributor

Should fix most build failures in Next 16.
Support for incremental prefetching (Fix #1022)
Support for incremental prefetching in the cache interceptor
Fix #1026

@changeset-bot
Copy link

changeset-bot bot commented Oct 28, 2025

🦋 Changeset detected

Latest commit: d017a4a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@opennextjs/aws Minor
app-pages-router Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 28, 2025

Open in StackBlitz

pnpm add https://pkg.pr.new/@opennextjs/aws@1029

commit: d017a4a

@github-actions
Copy link
Contributor

github-actions bot commented Oct 28, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 28.05% 2855 / 10178
🔵 Statements 28.05% 2855 / 10178
🔵 Functions 52.46% 149 / 284
🔵 Branches 76.19% 717 / 941
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/open-next/src/adapters/cache.ts 84.82% 83.73% 100% 84.82% 22-23, 87-95, 151-171, 193-194, 379-387, 421-422, 456-465, 475-483
packages/open-next/src/adapters/plugins/image-optimization/image-optimization.replacement.ts 0% 0% 0% 0% 1-49
packages/open-next/src/build/copyTracedFiles.ts 8.1% 100% 25% 8.1% 60-64, 76-399
packages/open-next/src/build/createAssets.ts 0% 0% 0% 0% 1-298
packages/open-next/src/core/routing/cacheInterceptor.ts 79.79% 71.83% 85.71% 79.79% 52, 63-69, 83-84, 109-135, 151-154, 164-167, 222-223, 244-246, 251-252, 263-265, 275-276, 357-358
packages/open-next/src/types/overrides.ts 0% 0% 0% 0%
Generated in workflow #1611 for commit d017a4a by the Vitest Coverage Report Action

@khuezy
Copy link
Contributor

khuezy commented Oct 28, 2025

Do we have to handle the middleware => proxy renaming in 16?

@conico974
Copy link
Contributor Author

Do we have to handle the middleware => proxy renaming in 16?

Nope it doesn't change the name of the compiled file, but we have to update to Node 20 for e2e it seems....


const imageUpstream = isAbsolute
? await fetchExternalImage(href)
? //@ts-ignore
Copy link
Contributor

@sommeeeer sommeeeer Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary? If so do an expect-error with description.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it's related to #1026 (the signature changed with Next 16).
+1 to add a comment about that

// size config to also set the ImageResponse's width and height.
...size,
headers: {
"cache-control": "public, immutable, no-transform, max-age=31536000",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you set this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Next does not automatically set the cache on this anymore. Need to test with next start

Copy link
Contributor

@sommeeeer sommeeeer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good job Nico! It seems to pass the E2E locally for me on Next 16.

Just a few comments and also could you rename the middleware files to proxy in all the examples app. (npx @next/codemod@canary middleware-to-proxy .)

To make the E2E work both locally and deployed we need to change this to 20:

And all the Runtime.NODEJS_18_X into Runtime.NODEJS_20_X in OpenNextReferenceImplementation.ts.
Also update package.json here:

"node": ">=18",

Perhaps remove these lines as we already setup node and pnpm cache in the setup/action.yml :

- name: Set up NodeJS v18
uses: actions/setup-node@v4
with:
cache: pnpm # cache pnpm store
node-version: 18.18.2

However, we might do this in a seperate PR. Up to you.

Comment on lines 180 to 181
cacheFileMeta &&
Array.isArray(cacheFileMeta.segmentPaths) &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cacheFileMeta &&
Array.isArray(cacheFileMeta.segmentPaths) &&
Array.isArray(cacheFileMeta?.segmentPaths) &&

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cacheFileMeta.segmentPaths.length > 0 could also be skipped maybe

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe something like:

const segments: Record<string, string> = Array.isArray(cacheFileMeta?.segmentPaths) ? 
  Object.fromEntries(cacheFileMeta.segmentPaths.map(...)) :
  {};

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.

fetchExternalImage signature change -> e2e failure Handle segment data in the incremental cache

5 participants