Skip to content

fix(next/routing): apply only matching onMatch rules#90736

Open
pieh wants to merge 2 commits intovercel:canaryfrom
pieh:fix/next-routing-on-match-matching
Open

fix(next/routing): apply only matching onMatch rules#90736
pieh wants to merge 2 commits intovercel:canaryfrom
pieh:fix/next-routing-on-match-matching

Conversation

@pieh
Copy link
Contributor

@pieh pieh commented Mar 1, 2026

Fix for @next/routing lib to not apply onMatch rules on matches if onMatch conditions are not met.

Currently Adapters API output for immutable permanent cache-control header is applied to all matches, not just /_next/static ones.

This is trying to address point 3. from nextjs/adapters-wg#1 (other reports were already addressed in #89197)

@nextjs-bot
Copy link
Collaborator

Allow CI Workflow Run

  • approve CI run for commit: b9fe476

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

1 similar comment
@nextjs-bot
Copy link
Collaborator

Allow CI Workflow Run

  • approve CI run for commit: b9fe476

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

@mischnic mischnic requested a review from ijjk March 7, 2026 11:25
# Conflicts:
#	packages/next-routing/src/resolve-routes.ts
@nextjs-bot
Copy link
Collaborator

nextjs-bot commented Mar 10, 2026

Failing test suites

Commit: 8be3aac | About building and testing Next.js

pnpm test test/integration/image-optimizer/test/max-disk-size-cache-85kb.test.ts (turbopack) (job)

  • with maximumDiskCacheSize 85KB config > Production Mode Server support with next.config.js > should follow redirect from http to https when maximumRedirects > 0 (DD)
Expand output

● with maximumDiskCacheSize 85KB config › Production Mode Server support with next.config.js › should follow redirect from http to https when maximumRedirects > 0

expect(received).toBe(expected) // Object.is equality

Expected: 200
Received: 500

  238 |       const query = { url, w: ctx.w, q: ctx.q }
  239 |       const res = await fetchViaHTTP(ctx.appPort, '/_next/image', query, {})
> 240 |       expect(res.status).toBe(maximumRedirects > 0 ? 200 : 508)
      |                          ^
  241 |     })
  242 |
  243 |     it('should follow redirect when dangerouslyAllowLocalIP enabled', async () => {

  at Object.toBe (integration/image-optimizer/test/util.ts:240:26)

pnpm test test/integration/telemetry/test/index.test.ts (turbopack) (job)

  • Telemetry CLI > production mode > emits event when swc fails to load (DD)
Expand output

● Telemetry CLI › production mode › emits event when swc fails to load

expect(received).toMatch(expected)

Expected pattern: /NEXT_SWC_LOAD_FAILURE/
Received string:  "⚠ Failed to load triple linux-x64-gnu: Cannot load native addon because loading addons is disabled.
⚠ Failed to load triple linux-x64-musl: Cannot find module '/root/actions-runner/_work/next.js/next.js/packages/next-swc/native/next-swc.linux-x64-musl.node'
Require stack:
- /root/actions-runner/_work/next.js/next.js/packages/next/dist/build/swc/index.js
- /root/actions-runner/_work/next.js/next.js/packages/next/dist/build/analysis/parse-module.js
- /root/actions-runner/_work/next.js/next.js/packages/next/dist/build/analysis/get-page-static-info.js
- /root/actions-runner/_work/next.js/next.js/packages/next/dist/build/route-discovery.js
- /root/actions-runner/_work/next.js/next.js/packages/next/dist/build/index.js
- /root/actions-runner/_work/next.js/next.js/packages/next/dist/cli/next-build.js
⚠ Attempted to load @next/swc-wasm-nodejs, but it was not installed
⚠ Attempted to load @next/swc-wasm-web, but it was not installed
⨯ Failed to load SWC binary for linux/x64, see more info here: https://nextjs.org/docs/messages/failed-loading-swc·
> Build error occurred
Error: Failed to load SWC binary for linux/x64, see more info here: https://nextjs.org/docs/messages/failed-loading-swc

  at <unknown> (../dist/build/swc/index.js:323:38)
  "
  at Object.toMatch (integration/telemetry/test/index.test.ts:111:24)

pnpm test-start test/e2e/app-dir/nx-handling/nx-handling.test.ts (job)

  • nx-handling > should work for pages page (DD)
  • nx-handling > should work for pages API (DD)
  • nx-handling > should work with app page (DD)
  • nx-handling > should work with app route (DD)
Expand output

● nx-handling › should work for pages page

next start exited unexpectedly with code/signal 130

  169 |               require('console').error(message)
  170 |             }
> 171 |             reject(new Error(message))
      |                    ^
  172 |           }
  173 |         })
  174 |

  at ChildProcess.<anonymous> (lib/next-modes/next-start.ts:171:20)

● nx-handling › should work for pages API

next start exited unexpectedly with code/signal 130

  169 |               require('console').error(message)
  170 |             }
> 171 |             reject(new Error(message))
      |                    ^
  172 |           }
  173 |         })
  174 |

  at ChildProcess.<anonymous> (lib/next-modes/next-start.ts:171:20)

● nx-handling › should work with app page

next start exited unexpectedly with code/signal 130

  169 |               require('console').error(message)
  170 |             }
> 171 |             reject(new Error(message))
      |                    ^
  172 |           }
  173 |         })
  174 |

  at ChildProcess.<anonymous> (lib/next-modes/next-start.ts:171:20)

● nx-handling › should work with app route

next start exited unexpectedly with code/signal 130

  169 |               require('console').error(message)
  170 |             }
> 171 |             reject(new Error(message))
      |                    ^
  172 |           }
  173 |         })
  174 |

  at ChildProcess.<anonymous> (lib/next-modes/next-start.ts:171:20)

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.

3 participants