Skip to content

docs: remove deprecated url.parse() from custom server example#86972

Closed
DeveloperViraj wants to merge 46 commits into
vercel:canaryfrom
DeveloperViraj:fix/remove-deprecated-url-parse
Closed

docs: remove deprecated url.parse() from custom server example#86972
DeveloperViraj wants to merge 46 commits into
vercel:canaryfrom
DeveloperViraj:fix/remove-deprecated-url-parse

Conversation

@DeveloperViraj
Copy link
Copy Markdown
Contributor

This PR updates the custom server documentation to remove usage of Node's
deprecated url.parse() API. The example does not require URL parsing, since
the parsedUrl argument is optional for the Next.js RequestHandler.

Removing url.parse() avoids Node deprecation warnings (DEP0116, DEP0169)
and aligns the example with current best practices.

This implements the minimal fix suggested in issue #86951.

Why?

  • url.parse() is deprecated in modern Node versions.
  • The example works without URL parsing.
  • Keeps documentation aligned with recommended APIs.

How?

  • Removed url.parse() import.
  • Removed parsedUrl creation.
  • Updated both TS and JS examples to simply call handle(req, res).

Fixes #86951

nextjs-bot and others added 30 commits August 25, 2025 18:48
… (vercel#83028)

`config.api.responseLimit` can also be [set to

`false`](vercel#82842 (comment)).
Because of the limitations of type inference on JS files, we need to set
the type to `boolean`.

See
vercel#82842 (comment)

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->
…#83027)

I updated the return type of API routes and route handlers from

```ts
Promise<Response> | Response | Promise<void> | void
```

to 

```ts
Promise<Response | void> | Response | void
```

which fixes vercel#82842.

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->
…) (vercel#83060)

Biome is close to releasing their fix for Tailwind parsing, but it'll be
released in the next minor version.

We want to make sure that linting the template doesn't show any problems
arising from Tailwind at-rules in the meantime.

(See vercel#82974 and vercel#82826)
…ercel#83190)

Fixed vercel#83063 

- **Problem**: `next dev` produced overly deep relative imports in
`validator.ts` that differed from `next typegen`/`next build`.
- **Cause**: Dev pre-relativized page file paths and didn’t pass
`validatorFilePath`, causing incorrect relative path computation.
- **Solution**:
  - Pass `validatorFilePath` to `createRouteTypesManifest` in dev.
- Stop pre-relativizing file paths; provide absolute `fileName` so the
manifest computes paths relative to the validator directory.
- **Result**: `validator.ts` now uses correct, shallow relative imports,
matching `next typegen` and `next build`.
- **Verification**: Reproduced with
`test/e2e/app-dir/typed-routes-validator`; outputs from `pnpm next dev`
and `pnpm next typegen` now match.

### Example
Before (next dev):
```typescript
// Validate ../../../../../../app/page.tsx
{
  const handler = {} as typeof import("../../../../../../app/page.js")
  handler satisfies AppPageConfig<"/">
}
```

After (next dev/typegen/build):
```typescript
// Validate ../../app/page.tsx
{
  const handler = {} as typeof import("../../app/page.js")
  handler satisfies AppPageConfig<"/">
}
```

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->
Co-authored-by: Zack Tanner <1939140+ztanner@users.noreply.github.com>
…ercel#83805)

Co-authored-by: Luke Sandberg <lukesandberg@users.noreply.github.com>
Collects a bunch of docs improvements and fixes.

---------

Co-authored-by: Lee Robinson <lee@leerob.com>
Co-authored-by: Felix Shih <25448040+fufuShih@users.noreply.github.com>
Co-authored-by: Benjamin Woodruff <benjamin.woodruff@vercel.com>
Co-authored-by: David <75678655+dwrth@users.noreply.github.com>
Co-authored-by: Aymeric PINEAU <62554073+aymericzip@users.noreply.github.com>
Co-authored-by: Luca Krebs <41986129+obendev@users.noreply.github.com>
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
Co-authored-by: Rich Haines <hello@richardhaines.dev>
Co-authored-by: Mohammad Nedaeifard <46691519+OoMNoO@users.noreply.github.com>
Co-authored-by: pontasan <48611107+pontasan@users.noreply.github.com>
Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: Honda Yuto <132035494+HondaYt@users.noreply.github.com>
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
Co-authored-by: ryu <114303361+ryuapp@users.noreply.github.com>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: Lorenzo Palmes <lpalmes@gmail.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
nextjs-bot and others added 16 commits September 23, 2025 15:59
Backports:
- vercel#84539
- vercel#84712

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
Additional group of docs improvements.

---------

Co-authored-by: François Martin <f.martin@fastmail.com>
Co-authored-by: liketiger <50165633+liketiger@users.noreply.github.com>
Co-authored-by: Milancen123 <122306536+Milancen123@users.noreply.github.com>
Co-authored-by: geraldochristiano <68152918+geraldochristiano@users.noreply.github.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Anshuman Bhardwaj <anshu5074@gmail.com>
Co-authored-by: Karl Horky <karl.horky@gmail.com>
Co-authored-by: João Henrique <117238473+joao4xz@users.noreply.github.com>
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
Was fixed on canary in vercel#84922

Very annoying test setup
* Update React Version

Update React Version

* Disable some tests that fail spuriously. Should improve test coverage of otherwise blocked tests
@nextjs-bot nextjs-bot added create-next-app Related to our CLI tool for quickly starting a new Next.js application. Documentation Related to Next.js' official documentation. Font (next/font) Related to Next.js Font Optimization. tests Turbopack Related to Turbopack with Next.js. type: next labels Dec 9, 2025
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Dec 9, 2025

Notifying the following users due to files changed in this PR based on this repo's notify modifiers:

@timneutkens, @ijjk, @shuding, @huozhi:

packages/next/src/server/config.ts

@icyJoseph
Copy link
Copy Markdown
Member

Closing because of the gigantic amount of unrelated changes.

@icyJoseph icyJoseph closed this Dec 9, 2025
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Dec 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

create-next-app Related to our CLI tool for quickly starting a new Next.js application. Documentation Related to Next.js' official documentation. Font (next/font) Related to Next.js Font Optimization. locked tests Turbopack Related to Turbopack with Next.js. type: next

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs: deprecated url.parse() call used in custom server example