Skip to content

Fix custom server conf propagation#93645

Open
KurodaKayn wants to merge 1 commit intovercel:canaryfrom
KurodaKayn:fix/custom-server-conf-base-path
Open

Fix custom server conf propagation#93645
KurodaKayn wants to merge 1 commit intovercel:canaryfrom
KurodaKayn:fix/custom-server-conf-base-path

Conversation

@KurodaKayn
Copy link
Copy Markdown

Fixes #87429

What?

Ensures config passed through next({ conf }) in a custom server is applied consistently across the router and render server pipeline.

Why?

Custom server config such as basePath was loaded by the router server but not propagated into the internal render server. As a result, requests using basePath could still render with the default config and return 404.

How?

  • Pass conf from NextCustomServer.prepare() to getRequestHandlers()
  • Forward conf through router-server.initialize() into loadConfig()
  • Forward conf into renderServerOpts so the internal render server uses the same config
  • Preserve the custom server marker when initializing request handlers
  • Add an integration test covering basePath passed through next({ conf })

Verification

  • pnpm install --frozen-lockfile
  • pnpm --filter=next build
  • NEXT_SKIP_ISOLATE=1 NEXT_TEST_MODE=dev pnpm testheadless test/integration/custom-server/test/index.test.ts -t "with config provided through next"
  • git diff --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Passing configuration options as the conf property to the next() function in a custom server is ignored

1 participant