Can't verify this because there is no clear reproduction and I can't
reproduce it when manually trying, but this will probably fix#55649.
Not sure how they exit the process that it doesn't clean up on the
Node.js side though 🤔
<!-- 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: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
When errors are thrown in middleware it could re-send headers for the same response
```
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
at __node_internal_captureLargerStackTrace (node:internal/errors:490:5)
at new NodeError (node:internal/errors:399:5)
at ServerResponse.setHeader (node:_http_outgoing:645:11)
at origSetHeader (/next.js/packages/next/src/server/base-server.ts:777:16)
at ServerResponse._res.setHeader (/next.js/packages/next/src/server/base-s
erver.ts:777:16)
at setHeader (/next.js/packages/next/src/server/base-http/node.ts:84:15)
at renderErrorImpl (/next.js/packages/next/src/server/base-server.ts:2790:
11)
at <anonymous> (/next.js/packages/next/src/server/base-server.ts:2777:19)
at trace (/next.js/packages/next/src/server/lib/trace/tracer.ts:213:14)
at DevServer.renderError (/next.js/packages/next/src/server/base-server.ts
:2776:24)
at DevServer.renderError (/next.js/packages/next/src/server/next-server.ts
:1299:18)
at DevServer.handleRequestImpl (/next.js/packages/next/src/server/base-ser
ver.ts:1185:23) {
code: 'ERR_HTTP_HEADERS_SENT'
}
```
Migrate middleware-errors test to e2e test to avoid flaky assertion due to duplicated logging collected in integration test.
Closes NEXT-1629
- remove the slash before `pathname` (already included in the value).
- add `search` and `hash` values in redirected url:
- retains these values on redirect
- they already have `?` and `#` respectively
Co-authored-by: Balázs Orbán <18369201+balazsorban44@users.noreply.github.com>
In JS, Promise's are used to help manage async tasks and control flows. When code calls methods on a promise like `.then()`, `.catch()`, or `.finally()` the results of the promise are forwarded to the callback as soon as they're resolved. This serves to make a change to the promise creation such that we do not await on the promise until we're within the try/finally block. This will ensure that the promise will always be added to the map before it's resolved or rejected and it's cleanup (removing it from the active promises) is also completed.
This additionally introduces a new `scheduleOnNextTick` method and polyfill for `Promise.withResolvers()`.
`scheduleOnNextTick` is based on the scheduling algorithm used by https://github.com/graphql/dataloader which utilizes a `Promise.resolve()` combined with `process.nextTick` in order to schedule an operation to occur after the promises have resolved (see [graphql/dataloader](d336bd1528/src/index.js (L213-L255)))
The `Promise.withResolvers()` polyfill is an implementation of a soon-to-be-landed spec for inside-out promises. [Read the spec](https://tc39.es/proposal-promise-with-resolvers/)
This runs unit tests separate from the `test-dev` task to make it a bit more obvious these are running, and allow for an easy way to add any unit-test specific behavior in the future
[slack x-ref](https://vercel.slack.com/archives/C04DUD7EB1B/p1695150908857269)
## Fixing a bug
### What?
On these versions, SIGINT signals are `string`, exit callback recieves code `number`
### How?
We use code argument to quit process for `event`, and exit with code `0` for `SIGINT` and `SIGTERM` signals
Fixes#55605
Co-authored-by: Jiachi Liu <4800338+huozhi@users.noreply.github.com>
[As of Bun v1.0.0](https://bun.sh/blog/bun-v1.0#changelog-since-v0-8), `bun dev` runs the "dev" script from package.json. Therefore, as with Yarn and pnpm, the "run" command is not necessary.
This PR changes the `create-next-app` README templates to show `bun dev` instead of `bun run dev`.
The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-GRAPHQL-5905181
Co-authored-by: snyk-bot <snyk-bot@snyk.io>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
`isAppLayer` condition was missing `app-metadata-route` layer, made it
as a util now like other webpack layer utils, add metadata route layer
to the group. Then `React.cache` can be available there.
Also update regex to be compatible across platform
Fixes#55561
Closes NEXT-1635
### What?
Moving maintenance to a separate repository.
### Why?
I want to make these actions reusable in other projects as they seem to work well in the Next.js repository.
### How?
The code is moved to https://github.com/balazsorban44/nissuer
I tested it on my fork, and all the following functionality is preserved: https://github.com/balazsorban44/next.js/issues/56
- [x] Close/lock/comment without a valid reproduction link
- [x] Minimize "+1"
- [x] Add labels based on user selection
- [x] Add comment based on the maintainer's label (eg.: "please add a complete reproduction")
This consolidates how we're evaluating when to opt into `react@experimental` since it's sprinkled in a lot of spots. Also adds a new flag to opt into the experimental channel
Closes NEXT-1632
Feedback from https://github.com/vercel/next.js/issues/48748#issuecomment-1714292279.
As per my testing, an App Router route of
```tsx
'use client'
import { Button } from 'mui-core'
export default function Page() {
return <Button>Hi</Button>
}
```
was improved from `2.4s (1221 modules)` to `1458ms (649 modules)` for the local dev.
Seems we occasionally have unhandledRejections with `ensurePage` due to
the our memoize handling not attaching `.catch` quick enough. This
updates to ensure `.catch()` is always present for that promise and
re-throwing separately.
Also, ensures the necessary `module.compiled` files for `route-modules`
are included in our build traces.
x-ref: [slack
thread](https://vercel.slack.com/archives/C04KC8A53T7/p1695072157528389?thread_ts=1695060035.024789&cid=C04KC8A53T7)
changed` failed `for `payment_failed` on line 45
### What?
Error in line 45 on type of payment_intent
### Why?
Example provided does not work
### How?
Added 'payment_'
We need to disable the default treat `middleware` and `pages/api` as
server-only, unless users explictly import "server-only" to poison it.
This will avoid the case that when a library is mixing "client-only" API
and shared components API in one bundle, and the shared API is used in
middleware or `pages/api` that might cause error. See the test case
added.
Follow up for #55394