status
stringclasses 1
value | repo_name
stringclasses 13
values | repo_url
stringclasses 13
values | issue_id
int64 1
104k
| updated_files
stringlengths 11
1.76k
| title
stringlengths 4
369
| body
stringlengths 0
254k
⌀ | issue_url
stringlengths 38
55
| pull_url
stringlengths 38
53
| before_fix_sha
stringlengths 40
40
| after_fix_sha
stringlengths 40
40
| report_datetime
unknown | language
stringclasses 5
values | commit_datetime
unknown |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
closed | vercel/next.js | https://github.com/vercel/next.js | 41,010 | ["examples/with-react-native-web/package.json"] | with-react-native-web React 18 | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #54-Ubuntu SMP Fri Aug 26 13:26:29 UTC 2022
Binaries:
Node: 16.13.2
npm: 8.19.2
Yarn: 1.12.3
pnpm: N/A
Relevant packages:
next: 12.3.1
eslint-config-next: N/A
react: 18.1.0
react-dom: 18.1.0
### Which example does this report relate to?
with-react-native-web
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
next start
### Describe the Bug
There's not really a bug this is more a question for the future relating to React 18.
In your documentation for the [custom document](https://nextjs.org/docs/advanced-features/custom-document) there's a note saying
> To prepare for [React 18](https://nextjs.org/docs/advanced-features/react-18), we recommend avoiding customizing getInitialProps and renderPage, if possible.
How would this example look in a React 18 scenario?
Is this one of the cases where it's not possible to avoid customizing through getInitialProps and renderPage?
### Expected Behavior
I would expect to be able to run this example using React 18 without leveraging getInitialProps and renderPage in_document.js
### To Reproduce
Does not apply | https://github.com/vercel/next.js/issues/41010 | https://github.com/vercel/next.js/pull/41024 | c889b31222c3b0d1ad868af12bdf38b244a6701a | 596148c580a6af579eb445e0e37cc7c48c829958 | "2022-09-28T23:10:13Z" | javascript | "2022-09-29T12:01:08Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 40,927 | ["packages/next/shared/lib/router/router.ts", "test/production/prerender-prefetch/index.test.ts"] | router.push() does not get the latest ISR on-demand revalidated page | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
```
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.6.0: Mon Aug 22 20:20:05 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T8101
Binaries:
Node: 14.19.1
npm: 8.6.0
Yarn: N/A
pnpm: N/A
Relevant packages:
next: 12.3.2-canary.9
eslint-config-next: 12.3.1
react: 18.2.0
react-dom: 18.2.0
```
### What browser are you using? (if relevant)
Safari version 16.0 (17614.1.25.9.10, 17614)
### How are you deploying your application? (if relevant)
next start or Vercel
### Describe the Bug
After ISR on-demand revalidation and waiting to the page to be regenerated, `router.push()` doesn't show the regenerated page where `next/link` does. It happens when you push or link from the page to itself.
### Expected Behavior
After revalidation, `router.push()` should show the new content.
### Link to reproduction
https://codesandbox.io/s/ancient-dew-d28bz0
### To Reproduce
The CodeSandbox above uses `next dev`. I'm referring to `next start` or deployment on Vercel.
1. Go to: [https://csb-d28bz0-nz1ywkx5j-anasqadrei.vercel.app](https://csb-d28bz0-nz1ywkx5j-anasqadrei.vercel.app)
index.js page has getStaticProps that will return the time of generation and show it on the page
```javascript
export async function getStaticProps() {
return {
props: {
time: new Date().getTime(),
},
}
}
```
2. The page has Link, push, push with skipClientCache, replace and reload. If you click any of those, the time won't change. You'll get the previously generated page.
3. Click revalidate. This will call the revalidate api. getStaticProps will be called, it will return a new time and a new page will be generated
4. Wait few seconds for the page to be regenerated
5. Click push, push with skipClientCache or replace. Nothing will happen. The time won't change. It gets the old generated page.
6. Click Link. The time will change and you will see the newly regenerated page.
The expected behaviour is to see a new time whenever push is clicked after revalidate | https://github.com/vercel/next.js/issues/40927 | https://github.com/vercel/next.js/pull/40932 | 4f70f3af5da4f3a7c260bce55e1a164ee2e952f6 | eb424042f83f1a1a04746734c3a75251d3ff7489 | "2022-09-27T02:19:25Z" | javascript | "2022-09-27T06:30:49Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 40,903 | ["packages/next/src/client/index.tsx", "test/e2e/pages-performance-mark/index.test.ts", "test/e2e/pages-performance-mark/next.config.js", "test/e2e/pages-performance-mark/pages/_document.js", "test/e2e/pages-performance-mark/pages/index.js"] | Having two Head components inside _document.tsx causes weird error | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #49~20.04.1-Ubuntu SMP Thu Aug 4 19:15:44 UTC 2022
Binaries:
Node: 16.14.2
npm: 8.5.0
Yarn: 1.22.11
pnpm: 7.9.0
Relevant packages:
next: 12.3.2-canary.7
eslint-config-next: 12.3.1
react: 18.2.0
react-dom: 18.2.0
**I don't see .8 yet on npm**
warn - Latest canary version not detected, detected: "12.3.2-canary.7", newest: "12.3.2-canary.8".
Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue.
Read more - https://nextjs.org/docs/messages/opening-an-issue
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
When accessing a page, you get a blank page and this error.
```js
DOMException: Failed to execute 'measure' on 'Performance': The mark 'beforeRender' does not exist.
at en (http://localhost:3000/_next/static/chunks/main-facca8e96989083b.js:1:17631)
at http://localhost:3000/_next/static/chunks/main-facca8e96989083b.js:1:18490
at Array.forEach (<anonymous>)
at http://localhost:3000/_next/static/chunks/main-facca8e96989083b.js:1:18463
at u2 (http://localhost:3000/_next/static/chunks/framework-03665ce53a58c61e.js:9:92095)
at oa (http://localhost:3000/_next/static/chunks/framework-03665ce53a58c61e.js:9:98841)
at e (http://localhost:3000/_next/static/chunks/framework-03665ce53a58c61e.js:9:111709)
at http://localhost:3000/_next/static/chunks/framework-03665ce53a58c61e.js:9:111720
at o8 (http://localhost:3000/_next/static/chunks/framework-03665ce53a58c61e.js:9:112231)
at oj (http://localhost:3000/_next/static/chunks/framework-03665ce53a58c61e.js:9:103020)
um @ framework-03665ce53a58c61e.js:9
```
Related: https://github.com/vercel/next.js/issues/20743
### Expected Behavior
no error
### Link to reproduction
https://github.com/awareness481/next-two-head-components
### To Reproduce
1. Run build command
2. Run start command
3. Visit index page
4. Observe error
( or run `pnpm create next-app` and copy-paste [_document.tsx](https://github.com/awareness481/next-two-head-components/blob/main/pages/_document.tsx) ) | https://github.com/vercel/next.js/issues/40903 | https://github.com/vercel/next.js/pull/54858 | f621defc11012632fc0f54c402471befc86cdd88 | 28ef2473af73e58521ad13b6e6b6d7f3d4d583e4 | "2022-09-26T14:28:03Z" | javascript | "2023-09-01T14:51:38Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 40,719 | ["packages/next/client/components/layout-router.tsx", "packages/next/client/index.tsx", "packages/next/shared/lib/router/router.ts"] | Next 12.3.1 breaks smooth-scrolling, change made in 12.3.1-canary.4, woks in 12.3.1-canary.3 and before | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.6.0: Sat Jun 18 17:07:25 PDT 2022; root:xnu-8020.140.41~1/RELEASE_X86_64
Binaries:
Node: 16.13.0
npm: 8.1.0
Yarn: 3.2.3
pnpm: N/A
Relevant packages:
next: 12.3.1-canary.3
eslint-config-next: N/A
react: 0.0.0-experimental-8951c5fc9-20220915
react-dom: 0.0.0-experimental-8951c5fc9-20220915
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
@timneutkens @cramforce The following commit completely disables smooth-scrolling- https://github.com/vercel/next.js/pull/40642. We use the following custom hook here to trigger the scroll-behaviour we want. We do not have anything else like a global css which sets the scroll-behaviour on html.
The scroll-behaviour becomes non-deterministic in version 12.3.1-canary.4, the previous version 12.3.1-canary.3 works perfectly. The latest release 12.3.1 is also affected.
```
import { MittEmitter } from '@app/render-utils';
import { useEffect } from 'react';
/**
* The scrolling behavior is always set to smooth, when a page mounts.
* On route change, the scrolling behavior switches to auto before it snaps back to smooth.
*
* Note:
* Do not use the nextJs hook "use-router" in this custom hook; constant re-renders get executed;
* Unfortunately, it seems there are some bugs in the router implementation (asPath / hash-change).
*
* Instead, the nextJs router events object from the _app component is given as an argument.
*/
export const useSmoothScroll = (events: MittEmitter) => {
const setSmoothScroll = (isSmooth: boolean) => {
document.documentElement.style.scrollBehavior = isSmooth
? 'smooth'
: 'auto';
};
useEffect(() => {
setSmoothScroll(true);
const handleRouteChangeStart = () => setSmoothScroll(false);
const handleRouteChangeComplete = () => setSmoothScroll(true);
events.on('routeChangeStart', handleRouteChangeStart);
events.on('routeChangeComplete', handleRouteChangeComplete);
return () => {
events.off('routeChangeStart', handleRouteChangeStart);
events.off('routeChangeComplete', handleRouteChangeComplete);
};
}, []);
};
```
Can you please provide feedback on how to enable scroll-behaviour using the hook again?
Thx!
### Expected Behavior
Identical behaviour like in 12.3.1-canary.3
### Link to reproduction
I will not create a reproducer for things y break; and smooth-scrolling is something which broke a few times in the past.
### To Reproduce
Use the hook from above in _app. | https://github.com/vercel/next.js/issues/40719 | https://github.com/vercel/next.js/pull/43673 | bd9148d498c7d2ad56539c0af1d4f1595b215bc1 | ba19ce3782f94d8803bd0fe91e95c23c07f80293 | "2022-09-20T14:36:18Z" | javascript | "2022-12-07T10:45:42Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 40,644 | ["packages/next/src/client/image.tsx", "packages/next/src/shared/lib/image-blur-svg.ts", "test/integration/next-image-new/default/pages/fill-blur.js", "test/integration/next-image-new/default/test/index.test.ts", "test/integration/next-image-new/default/test/static.test.ts"] | next/future/image blur placeholder does not fill parent div | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Binaries:
Node: 14.17.3
npm: 8.19.1
Yarn: 1.22.4
pnpm: N/A
Relevant packages:
next: 12.3.1-canary.3
eslint-config-next: 12.2.5
react: 18.2.0
react-dom: 18.2.0
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
The blur placeholder in next/future/image with fill=true is shown at the original image dimensions instead of filling the parent div (as the image does when loaded)
### Expected Behavior
Same behaviour as next/image, that the placeholder fills the parent div
Above: next/image
Below: next/future/image
<img width="1094" alt="futureImageBug" src="https://user-images.githubusercontent.com/18411522/190875513-92bfe39d-d788-474a-8ab7-a85f230cc4da.png">
### Link to reproduction
https://github.com/tiotdev/next-future-image-blur-fill-bug
### To Reproduce
```
import Image from "next/image";
import FutureImage from "next/future/image";
export default function Home() {
return (
<>
<div
style={{
width: "100%",
height: "200px",
backgroundColor: "red",
position: "relative",
}}
>
<Image
src="https://img.travelfeed.io/jpphotography%2F20200609T140211386Z-reisen-127.jpg"
alt=""
blurDataURL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAACCAIAAADwyuo0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAI0lEQVR4nGMINGf4/+3at/t7+2viGNQZGKbE69UlOSV5mgEAnuYKmizl818AAAAASUVORK5CYII="
placeholder="blur"
layout="fill"
objectFit="cover"
/>
</div>
<div
style={{
width: "100%",
height: "200px",
backgroundColor: "red",
position: "relative",
}}
>
<FutureImage
src="https://img.travelfeed.io/jpphotography%2F20200609T140211386Z-reisen-127.jpg"
alt=""
blurDataURL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAACCAIAAADwyuo0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAI0lEQVR4nGMINGf4/+3at/t7+2viGNQZGKbE69UlOSV5mgEAnuYKmizl818AAAAASUVORK5CYII="
placeholder="blur"
fill
sizes="100vw"
style={{ objectFit: "cover" }}
/>
</div>
</>
);
}
``` | https://github.com/vercel/next.js/issues/40644 | https://github.com/vercel/next.js/pull/44317 | b294073d0fa94f5a91c6d8f29907018ff26e2e65 | bf7fea5b8080cd9164ea7db70181c76d4164cb7b | "2022-09-17T20:40:14Z" | javascript | "2023-02-02T22:04:03Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 40,607 | ["docs/api-reference/data-fetching/get-server-side-props.md", "docs/api-reference/data-fetching/get-static-props.md"] | Docs: getStaticProps & InferGetStaticPropsType | TypeScript | ### What is the improvement or update you wish to see?

In the documentation, it is advised to type getStaticProps first, and then in the example with InferGetStaticPropsType, getStaticProps is not typed. The documentation should specify this type behavior explicitly. All examples of type behavior are listed in the examples below.
The same with the other rendering methods
### Is there any context that might help us understand?
Example 1. InferGetStaticPropsType is working as expected. Object `posts` in page Posts is type `types.Post[]`.
```
const Posts = ({ posts }: InferGetStaticPropsType<typeof getStaticProps>) => {
...
};
export const getStaticProps: GetStaticProps<{ posts: types.Post[] }> = async () => {
let data: {
allPosts: types.Post[];
};
// fetching data
const posts = data.allPosts;
return {
props: {
posts,
},
};
};
```
Example 2. The same as in the previous example, but the getStaticProps type is specified implicitly. This example is listed in the documentation.
```
const Posts = ({ posts }: InferGetStaticPropsType<typeof getStaticProps>) => {
...
};
export const getStaticProps = async () => {
let data: {
allPosts: types.Post[];
};
// fetching data
const posts = data.allPosts;
return {
props: {
posts,
},
};
};
```
Example 3. InferGetStaticPropsType is not working. Object `posts` in page Posts is type `any`.
```
const Posts = ({ posts }: InferGetStaticPropsType<typeof getStaticProps>) => {
...
};
export const getStaticProps: GetStaticProps = async () => {
let data: {
allPosts: types.Post[];
};
// fetching data
const posts = data.allPosts;
return {
props: {
posts,
},
};
};
```
### Does the docs page already exist? Please link to it.
https://nextjs.org/docs/api-reference/data-fetching/get-static-props#getstaticprops-with-typescript | https://github.com/vercel/next.js/issues/40607 | https://github.com/vercel/next.js/pull/40639 | 3ede313e1f22a165e0d3c42472e5940ff64b40f4 | c988b99c85bd5d59493bcee8eaa7916fc5d733c4 | "2022-09-16T11:29:00Z" | javascript | "2022-10-01T04:20:57Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 40,522 | ["packages/next/build/webpack-config.ts", "scripts/next-with-deps.sh", "test/production/disable-fallback-polyfills/index.test.ts"] | Cannot start when set fallbackNodePolyfills:false with axois. | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Binaries:
Node: 18.7.0
npm: 8.15.0
Yarn: 1.22.19
pnpm: 7.11.0
Relevant packages:
next: 12.3.1-canary.1
eslint-config-next: 12.3.0
react: 18.2.0
react-dom: 18.2.
### What browser are you using? (if relevant)
none
### How are you deploying your application? (if relevant)
next start
### Describe the Bug
cannot build nextjs application, when using axios as http framework.
```
./node_modules/.pnpm/[email protected]/node_modules/axios/lib/helpers/toFormData.js
Module not found: Can't resolve 'buffer' in 'node_modules/.pnpm/[email protected]/node_modules/axios/lib/helpers'
Import trace for requested module:
./node_modules/.pnpm/[email protected]/node_modules/axios/lib/axios.js
./node_modules/.pnpm/[email protected]/node_modules/axios/index.js
./src/services/request.ts
./src/pages/login/callback.tsx
./node_modules/.pnpm/[email protected]/node_modules/axios/lib/helpers/toFormData.js
Cannot read properties of undefined (reading 'module')
Import trace for requested module:
./node_modules/.pnpm/[email protected]/node_modules/axios/lib/axios.js
./node_modules/.pnpm/[email protected]/node_modules/axios/index.js
./src/services/request.ts
./src/pages/login/callback.tsx
```
### Expected Behavior
Build as usual.
### Link to reproduction
https://stackblitz.com/edit/vercel-next-js-28zg4e?file=package.json
### To Reproduce
just run it. | https://github.com/vercel/next.js/issues/40522 | https://github.com/vercel/next.js/pull/40612 | 1ea65cf931fbc5342855c74c0ee8543dc2083af4 | 8bf082a9134dfe8a8aa49f8c01bfda1f0830b5ed | "2022-09-13T19:42:37Z" | javascript | "2022-09-16T20:23:56Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 40,463 | ["packages/next/build/jest/jest.ts", "test/production/jest/new-link-behavior.test.ts"] | next/jest does not render correctly with experimental.newNextLinkBehavior enabled | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.6.0: Wed Aug 10 14:25:27 PDT 2022; root:xnu-8020.141.5~2/RELEASE_X86_64
Binaries:
Node: 16.16.0
npm: 8.11.0
Yarn: 1.22.17
pnpm: N/A
Relevant packages:
next: 12.3.1-canary.0
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
### What browser are you using? (if relevant)
_Not relevant_ (issue lies with `next/jest`)
### How are you deploying your application? (if relevant)
_Not relevant_ (issue lies with `next/jest`)
### Describe the Bug
It seems that the [experimental flag `newNextLinkBehavior`](https://github.com/vercel/next.js/pull/36436) is not being respected by `next/jest` even when using the with-jest boilerplate example.
The `next.config.js` file has been updated to include this flag:
```
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
experimental: {
newNextLinkBehavior: true
}
}
module.exports = nextConfig
```
The issue in general seems to be that the flag is not being respected at all by Jest, and it is simply rendering using the legacy behavior of `<Link>`. It is evident when looking at the discrepancy between the rendered results of the same JSX template on `index.tsx` vs what is rendered by the inline snapshot when running `index.test.tsx`:
## Failure to inherit additional props (e.g. `data-testid`)
In `index.tsx`, using the following JSX template with render with the following result:
```jsx
{/* index.tsx JSX template */}
<Link href="https://example.com" data-testid="link">
Link element with new behavior
</Link>
{/* index.tsx rendered */}
<a data-testid="link" href="https://example.com">Link element with new behavior</a>
```
However, running `index.test.tsx` with the same template will result in a different output:
```jsx
{/* index.test.tsx JSX template */}
<Link href="https://example.com" data-testid="link">
Link element with new behavior
</Link>
{/* index.test.tsx rendered in `toMatchInlineSnapshot()` */}
<a href="https://example.com">Link element with new behavior</a>
```
Notice that the `data-testid` fails to be rendered.
## Failure to render `<a>` in-place
The JSX template used is:
```jsx
<Link href="https://example.com" data-testid="link">
<strong data-testid="content">Link element with new behavior</strong>
</Link>
```
Rendered by `index.tsx`:
```
<a data-testid="link" href="https://example.com">
<strong data-testid="content">Link element with new behavior</strong>
</a>
```
Inline snapshot rendered by `index.test.tsx`:
```
<strong data-testid="content">Link element with new behavior</strong>
```
### Expected Behavior
It is expected that the Jest rendered output should match exactly as what is rendered by the dev server, i.e. it should respect the `newNextLinkBehavior` flag.
For example, for this JSX template:
```
<Link href="https://example.com" data-testid="link">
Link element with new behavior
</Link>
```
...should be rendered as the following when running Jest to generate an inline snapshot:
```
<a href="https://example.com" data-testid="link">Link element with new behavior</a>
```
### Link to reproduction
https://github.com/terrymun/nextjs-link-behavior-demo
### To Reproduce
You can use the following JSX templates to verify that the dev render and what Jest renders are very different:
```
<Link href="https://example.com" data-testid="link">
Link element with new behavior
</Link>
<Link href="https://example.com" data-testid="link">
<strong data-testid="content">Link element with new behavior</strong>
</Link>
```
In order to verify/reproduce the bug, simply check out the repository and run jest using `yarn test`. Notice that the incorrectly generated inline snapshots actually pass the tests, and these snapshots do not match the rendered behavior when serving the site in dev mode (or building it). | https://github.com/vercel/next.js/issues/40463 | https://github.com/vercel/next.js/pull/40702 | bf8ee1edb4f6b134ada58e2ea65e33670c0c08ea | 4970d7a0e84dfa4101f09a4476cb123759712bb0 | "2022-09-12T07:09:41Z" | javascript | "2022-09-22T05:36:59Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 40,432 | ["packages/next/shared/lib/router/router.ts", "test/e2e/middleware-base-path/app/pages/dynamic-routes/[routeName].js", "test/e2e/middleware-base-path/app/pages/index.js", "test/e2e/middleware-base-path/test/index.test.ts"] | After setting basePath in next.config.js, dynamic route parameters won't be included inside `router.query` object (useRouter) when routing from one page to another. | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #138-Ubuntu SMP Wed Jun 22 15:00:31 UTC 2022
Binaries:
Node: 18.6.0
npm: 8.13.2
Yarn: 0.32+git
pnpm: N/A
Relevant packages:
next: 12.3.1-canary.0
eslint-config-next: 12.2.3
react: 18.2.0
react-dom: 18.2.0
### What browser are you using? (if relevant)
Chrome Version 102.0.5005.115 (Official Build) (64-bit)
### How are you deploying your application? (if relevant)
next start
### Describe the Bug
**This bug only happens when:**
1. adding **basePath** (exp: '/manager') to **next.config.js**, and
2. a custom **middleware.ts** is used
It is similar to ['#38495'](https://github.com/vercel/next.js/issues/38495) but with basePath used.
Routing from page _'/manager'_ to _'/manager/properties/1'_ using `<Link href={{pathname: '/properties/[id]', query: { id: property.id }}} passHref>...</Link>`, **router = useRouter()** object in the second page will have its `router.query = {}`; an empty object.
If you reload the page _'/manager/properties/1'_, `router.query` will be loaded correctly `= {id: '1'}` but then will default to `{}` when routing to another dynamic and/or nested page.
**_Noting that this issue won't arise (and router.query will load correctly) if you delete basePath from next.config.js_**
### Expected Behavior
An expected behavior is to have `router.query = {id: '1'}` after redirecting from the first page to the second page described in previous point.
### Link to reproduction
https://github.com/ABDELMAJIDRami/basepathrouterbug
### To Reproduce
- clone project and install dependencies
- next dev
- open page `http://localhost:3000/manager`
- click the Link to redirect to 'manager/properties/1' page (Page B)
- page B shows the result of router.query object. Check console logs where i logged the router object (useRouter).
- Reload page B and check router.query again | https://github.com/vercel/next.js/issues/40432 | https://github.com/vercel/next.js/pull/40566 | 40b2d1382dcfd3c7dcb4549fc55e3fe8b8fd3675 | 755661144979db84e44caa5bb66b62e350f8a107 | "2022-09-10T18:46:23Z" | javascript | "2022-09-15T22:56:53Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 40,419 | ["packages/next/shared/lib/image-blur-svg.ts", "test/integration/image-optimizer/test/util.ts", "test/integration/next-image-new/base-path/test/static.test.js", "test/integration/next-image-new/default/pages/static-img.js", "test/integration/next-image-new/default/test/index.test.ts", "test/integration/next-image-new/default/test/static.test.ts"] | Next/future/image blur placeholder renders with visual artifacts | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:37 PDT 2022; root:xnu-8020.121.3~4/RELEASE_ARM64_T6000
Binaries:
Node: 16.16.0
npm: 8.11.0
Yarn: 1.22.19
pnpm: N/A
Relevant packages:
next: 12.3.0
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
### What browser are you using? (if relevant)
Chrome 105.0.5195.102
### How are you deploying your application? (if relevant)
Vercel and Linode (occurs in all environments)
### Describe the Bug
When using the Image component from ```next/future/image``` with a blur placeholder and base64 blurDataURL, the placeholder renders in Chrome 105.0.5195.102 with visual artifacts, likely because the placeholder is being requested with a different request URL (i.e. we specified a ```data:image/jpeg;``` but the placeholder in the browser is being requested as ```data:image/svg+xml``` with an svg filter applied
I deployed an example to https://nextjs-next-image-issue.vercel.app/ and https://github.com/iominh/nextjs-next-image-issue.
It might be hard to see the blur placeholder but if you use the chrome devtools to apply heavy throttling (e.g. with 3g) and/or just look at the devtools you'll see the placeholder is loaded incorrectly with visual artifacts and the wrong requestURL
Here's an example based on Next 12.3.0 and React 18.2.0:
```tsx
import type { NextPage } from "next";
import Head from "next/head";
import Image from "next/future/image";
import styles from "../styles/Home.module.css";
// Sample blur
export const blurDataURL =
"data:image/jpeg;base64,/9j/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAAHAAoDASIAAhEBAxEB/8QAFgABAQEAAAAAAAAAAAAAAAAAAAQF/8QAIRAAAQMEAQUAAAAAAAAAAAAAAQACAwQFCBETITJEUdL/xAAVAQEBAAAAAAAAAAAAAAAAAAAFBv/EABoRAQEAAgMAAAAAAAAAAAAAAAECABIEMUH/2gAMAwEAAhEDEQA/AJLRkG+kgbELPTyxcXQOlc0k++0rKkyA3I4mxU+yT5DvhEVZrIqHeFxx4p1fM//Z";
const Home: NextPage = () => {
return (
<div className={styles.container}>
<Head>
<title>Create Next App</title>
<meta name="description" content="Generated by create next app" />
<link rel="icon" href="/favicon.ico" />
</Head>
<main className={styles.main}>
<div className={styles.description}>
The below image should blur without visual artifacts
</div>
<Image
src="/tuqa-nabi-uhnZZUaTIOs-unsplash.jpg"
alt="Kitten"
width={2848}
height={4288}
placeholder="blur"
blurDataURL={blurDataURL}
></Image>
</main>
</div>
);
};
export default Home;
```
In the chrome dev tools you can see the placeholder renders like the following:

### Expected Behavior
I would've expected the placeholder to render without artifacts and with the correct type
Before next/future/image, the next/image component would return a placeholder like the following:
```
data:image/jpeg;base64,/9j/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAAHAAoDASIAAhEBAxEB/8QAFgABAQEAAAAAAAAAAAAAAAAAAAQF/8QAIRAAAQMEAQUAAAAAAAAAAAAAAQACAwQFCBETITJEUdL/xAAVAQEBAAAAAAAAAAAAAAAAAAAFBv/EABoRAQEAAgMAAAAAAAAAAAAAAAECABIEMUH/2gAMAwEAAhEDEQA/AJLRkG+kgbELPTyxcXQOlc0k++0rKkyA3I4mxU+yT5DvhEVZrIqHeFxx4p1fM//Z
```
Instead it now returns the following:
```
data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http%3A//www.w3.org/2000/svg' viewBox='0 0 2400 1601'%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='discrete' tableValues='1 1'/%3E%3C/feComponentTransfer%3E%%3C/filter%3E%3Cimage filter='url(%23b)' x='0' y='0' height='100%25' width='100%25' href='data:image/jpeg;base64,/9j/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAAHAAoDASIAAhEBAxEB/8QAFgABAQEAAAAAAAAAAAAAAAAAAAQF/8QAIRAAAQMEAQUAAAAAAAAAAAAAAQACAwQFCBETITJEUdL/xAAVAQEBAAAAAAAAAAAAAAAAAAAFBv/EABoRAQEAAgMAAAAAAAAAAAAAAAECABIEMUH/2gAMAwEAAhEDEQA/AJLRkG+kgbELPTyxcXQOlc0k++0rKkyA3I4mxU+yT5DvhEVZrIqHeFxx4p1fM//Z'/%3E%3C/svg%3E
```
### Link to reproduction
https://nextjs-next-image-issue.vercel.app/, https://github.com/iominh/nextjs-next-image-issue
### To Reproduce
Go to https://nextjs-next-image-issue.vercel.app/ to see the placeholder load or create an image like shown in the description above | https://github.com/vercel/next.js/issues/40419 | https://github.com/vercel/next.js/pull/41573 | 422ccb98b881816bd8f32b11d867dc5765292c10 | fe762d329fdf9d6d6e6bf084198ad49f696d42b7 | "2022-09-10T06:52:06Z" | javascript | "2022-10-19T20:21:41Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 40,410 | ["examples/with-google-analytics/pages/_document.js"] | window.gtag is not defined for Next.js-hydration event | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
```sh
Operating System:
Platform: linux
Arch: x64
Version: Ubuntu 20.04.0 LTS Fri Sep 09 2022 11:36:36 GMT-0700 (Pacific Daylight Time)
Binaries:
Node: 16.14.2
npm: 7.17.0
Yarn: 1.22.10
pnpm: 7.9.5
Relevant packages:
next: 12.3.1-canary.0
eslint-config-next: N/A
react: 17.0.1
react-dom: 17.0.1
```
### Which example does this report relate to?
with-google-analytics
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
calling `reportWebVitals` when having google analytics setup using `with-google-analytics` results in `Next.js-hydration` event getting triggered BEFORE gtag is initialized.
This could be problematic in production if someone is just assuming `gtag` is always defined when reporting on web vitals.
### Expected Behavior
When having google analytics setup using the `with-google-analytics` example, I would expect `gtag` to be defined for all events before triggering `reportWebVitals`.
### To Reproduce
Here is a link to reproduce: https://stackblitz.com/edit/nextjs-rnaue8?file=pages%2F_app.js,.env.local.example,lib%2Fgtag.js,pages%2Findex.js | https://github.com/vercel/next.js/issues/40410 | https://github.com/vercel/next.js/pull/40645 | f19241bf33d0428ff08469913bca78e719147e48 | bebf3725a83f59b3c07635f985fe6cec368c1b0b | "2022-09-09T18:52:52Z" | javascript | "2022-09-23T01:13:16Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 40,399 | ["packages/next-swc/Cargo.lock", "packages/next-swc/crates/core/Cargo.toml", "packages/next-swc/crates/emotion/Cargo.toml", "packages/next-swc/crates/modularize_imports/Cargo.toml", "packages/next-swc/crates/napi/Cargo.toml", "packages/next-swc/crates/styled_components/Cargo.toml", "packages/next-swc/crates/styled_jsx/Cargo.toml", "packages/next-swc/crates/wasm/Cargo.toml"] | Can't find variable _ after upgrading to Next 12.3 | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.6.0: Wed Aug 10 14:25:27 PDT 2022; root:xnu-8020.141.5~2/RELEASE_X86_64
Binaries:
Node: 16.13.1
npm: 6.14.8
Yarn: 1.22.19
pnpm: N/A
Relevant packages:
next: 12.3.0
eslint-config-next: 11.1.2
react: 17.0.2
react-dom: 17.0.2
### What browser are you using? (if relevant)
Reproduced with Firefox 104.0.1 and Safari 15.6.1
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
After upgrading to Next 12.3 this morning, I've immediately had a console error saying "Can't find variable _".
I've debugged my code, because it made no sense. I've upgraded Typescript, no change.
I've finally fixed it by finding the _ variable that was created after compilation, create a new named variable and use it.
My code used to be:
```
switch (component.type) {
```
it's now:
```
let componentType: string = component.type;
switch (componentType) {
```
It is a silly thing, but I've lost plenty of time because of this, and I'm still unclear what's the root cause.
### Expected Behavior
No error after compilation.
### Link to reproduction
It's a private repo
### To Reproduce
Hard to say how to reproduce outside of the code that is provided above. Let me know if I can provide anything more helpful. | https://github.com/vercel/next.js/issues/40399 | https://github.com/vercel/next.js/pull/40292 | 804dc6bd103dbb9867b82d40e033fb33500a45df | 53ce3bf248a570caf6b386e832d33c950e1cd43c | "2022-09-09T14:18:21Z" | javascript | "2022-09-12T16:36:44Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 40,389 | ["packages/create-next-app/helpers/examples.ts"] | Creating with-tailwindcss example instead creates with-tailwind-emotion | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: win32
Arch: x64
Version: Windows 10 Home
Binaries:
Node: 16.17.0
npm: N/A
Yarn: N/A
pnpm: N/A
Relevant packages:
next: 12.3.0
eslint-config-next: N/A
react: 18.1.0
react-dom: 18.1.0
### Which example does this report relate to?
with-tailwindcss
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
When calling
`yarn create next-app --example with-tailwindcss test`
or
`npx create-next-app --example with-tailwindcss test`
the project created is pulled from with-tailwindcss-emotion, rather than with-tailwindcss.
### Expected Behavior
A project is created from with-tailwindcss example.
### To Reproduce
Call
`yarn create next-app --example with-tailwindcss test`
or
`npx create-next-app --example with-tailwindcss test`. | https://github.com/vercel/next.js/issues/40389 | https://github.com/vercel/next.js/pull/40513 | 3cf7a30df92d8885daaec215c16fc2f22e8efc29 | a4ff04124290081939452167d84ada0d69cce0a2 | "2022-09-09T09:45:19Z" | javascript | "2022-09-13T20:51:44Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 40,388 | ["packages/next/shared/lib/dynamic.tsx", "test/integration/next-dynamic/test/index.test.js"] | incorrect warning: "loading" is ignored by next/dynamic because you have enabled "suspense". | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
λ npx --no-install next info
Operating System:
Platform: win32
Arch: x64
Version: Windows 10 Pro
Binaries:
Node: 18.4.0
npm: N/A
Yarn: N/A
pnpm: N/A
Relevant packages:
next: 12.3.0
eslint-config-next: 12.3.0
react: 18.2.0
react-dom: 18.2.0
warn - Latest canary version not detected, detected: "12.3.0", newest: "12.3.1-canary.0".
Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue.
Read more - https://nextjs.org/docs/messages/opening-an-issue
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
getting the error incorrectly:
"loading" is ignored by next/dynamic because you have enabled "suspense". Place your loading element in your suspense boundary's "fallback" prop instead. Read more: https://nextjs.org/docs/messages/invalid-dynamic-suspense"
where my suspense usage is:
```
import dynamic from "next/dynamic";
import { Suspense } from "react";
export default function Footer({ fluid }: { fluid: boolean }) {
return (
<Suspense fallback={null}>
<FooterLoader fluid={fluid} />
</Suspense>
);
}
const FooterLoader = dynamic(
() => import("components/organism/footer/content"),
{
ssr: true,
suspense: true,
}
);
```
According to https://nextjs.org/docs/messages/invalid-dynamic-suspense:
- I use react 18.
- I'm not using suspense with ssr: false.
- I'm not using suspense with loading.
When I add loading: undefined, the error is gone.
```
const FooterLoader = dynamic(
() => import("components/organism/footer/content"),
{
ssr: true,
suspense: true,
loading: undefined,
}
);
```
I think the offending PR is this: https://github.com/vercel/next.js/pull/39676/
### Expected Behavior
should not be generate a warning with this usage:
```
const FooterLoader = dynamic(
() => import("components/organism/footer/content"),
{
ssr: true,
suspense: true,
}
);
```
### Link to reproduction
n/a
### To Reproduce
```
import dynamic from "next/dynamic";
import { Suspense } from "react";
export default function Footer({ fluid }: { fluid: boolean }) {
return (
<Suspense fallback={null}>
<FooterLoader fluid={fluid} />
</Suspense>
);
}
const FooterLoader = dynamic(
() => import("components/organism/footer/content"),
{
ssr: true,
suspense: true,
}
);
``` | https://github.com/vercel/next.js/issues/40388 | https://github.com/vercel/next.js/pull/40397 | b09592e6acb96f7dfdf1ab3b7d54f1bbbe8a046d | 3d23c3d9ee84ce9ca8a1216ac3a5196d1e24e22c | "2022-09-09T09:18:13Z" | javascript | "2022-09-09T19:46:23Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 40,368 | ["packages/next/server/config-schema.ts"] | Build warns about `experimental: { esmExternals: 'loose' }` | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
```
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.6.0: Wed Aug 10 14:25:27 PDT 2022; root:xnu-8020.141.5~2/RELEASE_X86_64
Binaries:
Node: 16.15.1
npm: 8.18.0
Yarn: 1.22.19
pnpm: N/A
Relevant packages:
next: 12.3.0
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
```
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
Running `npm run build` outputs this warning:
```
warn - Invalid next.config.js options detected:
- The value at .experimental.esmExternals must be a boolean but it was a string.
```
But:
* `esmExternals` has long been allowed to be `'loose'` instead of a boolean
* [that setting is still checked for](https://github.com/vercel/next.js/blob/canary/packages/next/build/webpack-config.ts#L429)
* [an integration test still has such a configuration](https://github.com/vercel/next.js/blob/7a8da9741ddbe4a7b672b9a3e474d74f0a80aa46/test/integration/externals-esm-loose/next.config.js).
So I think the warning is erroneous. Or else some documentation of a change is missing.
### Expected Behavior
No warning.
### Link to reproduction
https://github.com/gthb/next.js-repro-erroneous-esmExternals-warning
### To Reproduce
Put this in your `next.config.js` exports:
```js
experimental: {
esmExternals: 'loose',
}
``` | https://github.com/vercel/next.js/issues/40368 | https://github.com/vercel/next.js/pull/40377 | 614f0d8e19a80cbb5f707b2201c7fb3ec5f3a831 | 9ab5c012bffd9ca410978577d38b9a7a8e8db6d6 | "2022-09-08T18:24:10Z" | javascript | "2022-09-09T02:35:33Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 40,367 | ["examples/with-rebass/.babelrc", "examples/with-rebass/package.json", "examples/with-rebass/pages/_document.js", "examples/with-strict-csp/pages/_document.js"] | with-strict-csp example doesn't run | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: win32
Arch: x64
Version: Windows 10 Pro
Binaries:
Node: 16.15.1
npm: 8.11.0
Yarn: 1.22.18
pnpm: 7.5.2
Relevant packages:
next: 12.3.0
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
### Which example does this report relate to?
with-strict-csp
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
I'm looking at #39871 to learn how to write a functional style `Document` component.
`with-strict-csp` example now uses `this` in a functional component, which doesn't work.
### Expected Behavior
Example runs.
### To Reproduce
1. Visit https://stackblitz.com/github/vercel/next.js/tree/canary/examples/with-strict-csp?file=README.md | https://github.com/vercel/next.js/issues/40367 | https://github.com/vercel/next.js/pull/40395 | a3a20dcbc1358f0362b74717c2fc3fa1e97a06b1 | 13e423ccf61a96dc5c0ca5e10107e368d06c376d | "2022-09-08T18:18:00Z" | javascript | "2022-09-09T13:35:37Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 40,364 | ["packages/next/build/webpack-config.ts", "scripts/next-with-deps.sh", "test/production/disable-fallback-polyfills/index.test.ts"] | fallbackNodePolyfills: false -> Module not found: Can't resolve 'path' in `next/future/image` (micromatch) | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 21.6.0: Wed Aug 10 14:28:23 PDT 2022; root:xnu-8020.141.5~2/RELEASE_ARM64_T6000
Binaries:
Node: 16.16.0
npm: 8.15.1
Yarn: 3.2.1
pnpm: N/A
Relevant packages:
next: 12.3.0
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
### What browser are you using? (if relevant)
Edge 105.0.1343.27 (Official build) (arm64)
### How are you deploying your application? (if relevant)
not relevant but, `next dev` / `next build` / `next start`
### Describe the Bug
12.3.0 added a new experimental config option called `fallbackNodePolyfills` to prevent polyfilling and getting feedback when you might use an internal node module inside your client.
https://nextjs.org/blog/next-12-3#other-improvements
This seems to clash with `next/future/image` using `micromatch` which uses node specific modules.
```
../../node_modules/next/dist/compiled/micromatch/index.js:22:3426
Module not found: Can't resolve 'path'
Import trace for requested module:
../../node_modules/next/dist/shared/lib/match-remote-pattern.js
../../node_modules/next/dist/client/future/image.js
../../node_modules/next/future/image.js
./src/components/SidebarLayout.tsx
./src/pages/docs/[...slug].tsx
https://nextjs.org/docs/messages/module-not-found
```
### Expected Behavior
`next/future/image` not throwing and working correctly with `fallbackNodePolyfills: false`
### Link to reproduction
https://stackblitz.com/edit/vercel-next-js-sckjm9?file=next.config.js
### To Reproduce
Just open the stackblitz, thats all to it.
```tsx
import Image from 'next/future/image';
/** Add your relevant code here for the issue to reproduce */
export default function Home() {
return <Image src='https://raw.githubusercontent.com/discordjs/discord.js/main/.github/powered-by-vercel.svg' width={100} height={100} />;
}
```
```js
/** @type {import("next").NextConfig} */
module.exports = {
reactStrictMode: true,
images: {
domains: ['raw.githubusercontent.com'],
},
experimental: {
fallbackNodePolyfills: false,
},
};
``` | https://github.com/vercel/next.js/issues/40364 | https://github.com/vercel/next.js/pull/40612 | 1ea65cf931fbc5342855c74c0ee8543dc2083af4 | 8bf082a9134dfe8a8aa49f8c01bfda1f0830b5ed | "2022-09-08T17:34:40Z" | javascript | "2022-09-16T20:23:56Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 40,334 | ["package.json", "packages/next-polyfill-module/package.json", "packages/next-polyfill-nomodule/package.json", "packages/next/package.json", "pnpm-lock.yaml", "turbo.json"] | Unable to run next on canary branch: Cannot find module './polyfills/polyfill-nomodule' | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Tried on 3 different platforms: Linux x86_64, MacOS arm64, and MacOS x86_64. Tried also with different nodejs versions from 14 through 18.
A few example environments:
```
$ pnpm next info
> [email protected] next /home/ubuntu/next.js
> node --trace-deprecation --enable-source-maps packages/next/dist/bin/next "info"
Operating System:
Platform: linux
Arch: x64
Version: #76~18.04.1-Ubuntu SMP Mon Mar 28 17:49:57 UTC 2022
Binaries:
Node: 16.17.0
npm: 8.15.0
Yarn: 1.22.19
pnpm: 7.3.0
Relevant packages:
next: 12.2.6-canary.11
eslint-config-next: 12.2.6-canary.11
react: 18.2.0
react-dom: 18.2.0
```
```
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 21.6.0: Wed Aug 10 14:28:23 PDT 2022; root:xnu-8020.141.5~2/RELEASE_ARM64_T6000
Binaries:
Node: 18.8.0
npm: 8.18.0
Yarn: 1.22.19
pnpm: 7.3.0
Relevant packages:
next: 12.2.6-canary.11
eslint-config-next: 12.2.6-canary.11
react: 18.2.0
react-dom: 18.2.0
```
```
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.6.0: Wed Aug 10 14:25:27 PDT 2022; root:xnu-8020.141.5~2/RELEASE_X86_64
Binaries:
Node: 16.17.0
npm: 8.15.0
Yarn: 1.22.19
pnpm: 7.3.0
Relevant packages:
next: 12.2.6-canary.11
eslint-config-next: 12.2.6-canary.11
react: 18.2.0
react-dom: 18.2.0
```
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
Running any example or test fails, cannot find polyfill-nomodule.
```
$ pnpm next examples/hello-world/
> [email protected] next /home/ubuntu/next.js
> node --trace-deprecation --enable-source-maps packages/next/dist/bin/next "examples/hello-world/"
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info - Using locally built binary of @next/swc
Error: Cannot find module './polyfills/polyfill-nomodule'
Require stack:
- /home/ubuntu/next.js/packages/next/dist/build/webpack-config.js
- /home/ubuntu/next.js/packages/next/dist/server/dev/hot-reloader.js
- /home/ubuntu/next.js/packages/next/dist/server/dev/next-dev-server.js
- /home/ubuntu/next.js/packages/next/dist/server/next.js
- /home/ubuntu/next.js/packages/next/dist/server/lib/start-server.js
- /home/ubuntu/next.js/packages/next/dist/cli/next-dev.js
- /home/ubuntu/next.js/packages/next/dist/lib/commands.js
- /home/ubuntu/next.js/packages/next/dist/bin/next
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15)
at call (/home/ubuntu/next.js/packages/next/build/webpack/require-hook.ts:25:28)
at call (/home/ubuntu/next.js/packages/next/build/webpack/require-hook.ts:25:28)
at Function.mod._resolveFilename (/home/ubuntu/next.js/packages/next/build/webpack/require-hook.ts:25:28)
at Function.resolve (node:internal/modules/cjs/helpers:108:19)
at Object.getBaseWebpackConfig (/home/ubuntu/next.js/packages/next/build/webpack-config.ts:1778:29)
at async Promise.all (index 0)
at Span.traceAsyncFn (/home/ubuntu/next.js/packages/next/trace/trace.ts:106:14)
at Span.traceAsyncFn (/home/ubuntu/next.js/packages/next/trace/trace.ts:106:14)
at HotReloader.start (/home/ubuntu/next.js/packages/next/server/dev/hot-reloader.ts:559:26) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/ubuntu/next.js/packages/next/dist/build/webpack-config.js',
'/home/ubuntu/next.js/packages/next/dist/server/dev/hot-reloader.js',
'/home/ubuntu/next.js/packages/next/dist/server/dev/next-dev-server.js',
'/home/ubuntu/next.js/packages/next/dist/server/next.js',
'/home/ubuntu/next.js/packages/next/dist/server/lib/start-server.js',
'/home/ubuntu/next.js/packages/next/dist/cli/next-dev.js',
'/home/ubuntu/next.js/packages/next/dist/lib/commands.js',
'/home/ubuntu/next.js/packages/next/dist/bin/next'
]
}
ELIFECYCLE Command failed with exit code 1.
```
### Expected Behavior
Should be able to run without that error!
### Link to reproduction
https://github.com/vercel/next.js
### To Reproduce
```
git clone --depth=1 https://github.com/vercel/next.js.git
cd next.js
corepack enable pnpm
pnpm install
pnpm dev &
# wait
pnpm next examples/hello-world
``` | https://github.com/vercel/next.js/issues/40334 | https://github.com/vercel/next.js/pull/40335 | 73b473991c06aa7e41f231a903384f126e65c20b | 24f573f8be0baf76b36132e9770caabbc4626dd4 | "2022-09-07T23:36:48Z" | javascript | "2022-09-30T02:03:47Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 40,305 | ["packages/next/src/build/analysis/get-page-static-info.ts", "test/e2e/middleware-custom-matchers-i18n/test/index.test.ts"] | Middleware matcher behaves different between next start/dev and vercel | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
```
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:37 PDT 2022; root:xnu-8020.121.3~4/RELEASE_ARM64_T6000
Binaries:
Node: 14.18.1
npm: 6.14.15
Yarn: 1.22.19
pnpm: N/A
Relevant packages:
next: 12.2.5
eslint-config-next: 12.2.5
react: 18.2.0
react-dom: 18.2.0
```
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
vercel and next start
### Describe the Bug
During debugging a different bug I recognized that the matcher of the middleware behaves different between next start / next dev and vercel.
I setup a small example project:
- https://vercel-middleware-index-404.vercel.app/
- https://github.com/PhilippSchreiber/vercel-middleware-index-404
It is using i18n with a default locale and a dynamic page [[...slug]].jsx
On local (start or dev)the middleware is not getting called for the index page (/) but for all other pages (`/en/`, `/ueber-uns/`, `/en/about-us/`). You can see the console.log.
On vercel the middleware gets called for all pages BUT `/`.
### Expected Behavior
The behavior of the middleware should be the same between next start and vercel
### Link to reproduction
https://github.com/PhilippSchreiber/vercel-middleware-index-404
### To Reproduce
Run the project locally and deploy it to vercel. Compare the logs from middleware when loading the index page `/`. | https://github.com/vercel/next.js/issues/40305 | https://github.com/vercel/next.js/pull/45504 | bb9428769bc7fee01cb2eff7110817a5ce6dfa97 | a85c636bfe6a4796b5cd27f69f3ec777531a82dd | "2022-09-07T11:23:29Z" | javascript | "2023-02-02T01:30:48Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 40,245 | ["packages/eslint-config-next/package.json", "packages/next/compiled/assert/assert.js", "packages/next/compiled/util/util.js", "pnpm-lock.yaml"] | ESLint randomly started enforcing new rule which is incorrect and breaking my builds | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Node version: `v16.15.1`
npm version: `8.19.0`
Local ESLint version: `8.23.0`
Global ESLint version: `N/A`
Operating System: `macOS Big Sur / M1 Mac`
### What browser are you using? (if relevant)
N/A
### How are you deploying your application? (if relevant)
Vercel
### Describe the Bug
ESLint is enforcing a rule which is breaking my build.
| File | Vercel Build Error |
|:-------------:|:-------------:|
|||
I went through my old vercel builds and found where it stopped working—I updated some packages and that was it. I just tried to revert back to all the old package versions where the builds were working fine and I still am getting the errors now.
I'm not sure why ESLint decided to enforce this rule randomly or why it's throwing an error even though it's a real property. I know I can ignore it with next.js configs but I'm instead trying to figure out what's happening here.
I also have an identical personal portfolio project with the same setup code and up-to-date packages in which I'm not having this issue. I can't understand why it's only happening on this repo.
If you have any ideas as to what's happening please let me know, thank you.
I have made an issue over at [ESLint's repo](https://github.com/eslint/eslint/issues/16278) too as I'm not sure which would be more appropriate.
### Expected Behavior
Builds should pass.
### Link to reproduction
https://github.com/tr1s/nightizm
### To Reproduce
Run `npm run lint` and see that these errors are showing up. They shouldn't be showing up at all. | https://github.com/vercel/next.js/issues/40245 | https://github.com/vercel/next.js/pull/40246 | f33c23c1442357d2ec82ed0378ff336d64f4cdd4 | d0903a5c5be184f3656a9c8dc2f5c297cb280a4b | "2022-09-06T05:37:46Z" | javascript | "2022-09-13T01:55:44Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 40,241 | ["packages/next/server/base-server.ts", "packages/next/server/dev/next-dev-server.ts", "packages/next/server/router.ts", "test/production/required-server-files.test.ts"] | 12.2.6-canary.10 displaying JSON in browser instead of building page html | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 21.6.0: Wed Aug 10 14:28:23 PDT 2022; root:xnu-8020.141.5~2/RELEASE_ARM64_T6000
Binaries:
Node: 16.15.0
npm: 8.5.5
Yarn: 1.22.19
pnpm: N/A
Relevant packages:
next: 12.2.6-canary.9
eslint-config-next: 12.2.6-canary.9
react: 18.2.0
react-dom: 18.2.0
### What browser are you using? (if relevant)
Firefox
### How are you deploying your application? (if relevant)
Vercel
### Describe the Bug
When deploying to Vercel with the latest canary, visiting pages will sometimes flash the styled output and then display the page JSON in the browser:
<img width="2168" alt="Screenshot 2022-09-05 at 10 18 40 PM" src="https://user-images.githubusercontent.com/222170/188533225-a4af4840-c05f-4a14-a462-243b7770f34f.png">
### Expected Behavior
Page shoudl rendered with styled HTML.
### Link to reproduction
https://rhythm-marketing-git-update-next1226-gotrhythm.vercel.app/
### To Reproduce
Standard Next.js setup with i18n and basic middleware rewrite usage. | https://github.com/vercel/next.js/issues/40241 | https://github.com/vercel/next.js/pull/40333 | b86bf075639c0a899087831e731046e22af823b5 | 62c7eff35435f346f56f9f107bead86a51c60bae | "2022-09-06T02:21:46Z" | javascript | "2022-09-07T23:38:10Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 40,231 | ["packages/next-swc/crates/core/src/lib.rs", "packages/next-swc/crates/core/tests/loader/issue-40231/input.js", "packages/next-swc/crates/core/tests/loader/issue-40231/output.js"] | Bug with dynamic imports and module.exports | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
```
Operating System:
Platform: linux
Arch: x64
Version: #44~20.04.1tux3 SMP Wed Jul 20 21:18:32 UTC 2022
Binaries:
Node: 16.14.2
npm: 8.19.1
Yarn: N/A
pnpm: N/A
Relevant packages:
next: 12.2.5
eslint-config-next: 12.2.5
react: 18.2.0
react-dom: 18.2.0
```
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
The issue was found in the Next-translate library:
https://github.com/aralroca/next-translate/issues/851#issuecomment-1237189461
Since Next.js switched from using babel to using SWC we have encountered this issue. The library uses a configuration where it has a loader where until now it was recommended to use a dynamic import.
Now, this error is displayed:
```
Critical dependency: the request of a dependency is an expression
```
It can be "solved" by changing the dynamic import to `require`. The problem with `require` is that then, the bundle grows a lot compared to the dynamic import. With the dynamic import it creates different chunks and imports only the one that is needed.
### Expected Behavior
It should work `module.exports` with dynamic imports.
### Link to reproduction
https://github.com/aralroca/next-translate/tree/master/examples/complex
### To Reproduce
#### To reproduce it using the link:
- Clone
- `yarn && yarn start`
#### To reproduce it in any project:
Create a file with a dynamic import and `module.export`:
```js
function loadSomethingWithDynamicImport(param) {
return import(`something/${param}`).then(r => r.default)
}
module.exports = { loadSomethingWithDynamicImport }
```
Then import and use this helper in some page loader (for example inside `getInitialProps`) | https://github.com/vercel/next.js/issues/40231 | https://github.com/vercel/next.js/pull/45836 | a8b3e7809a07f644ba0ae41f4e5ea5df5cb0a964 | 6ea64002aa923f8a2f9a5992ec31b0fd386a27dc | "2022-09-05T15:35:56Z" | javascript | "2023-02-13T18:48:39Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 40,159 | ["packages/next/taskfile.js"] | Custom server with "type": "module" in root package.json breaks next/config import | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:23 PDT 2021; root:xnu-8019.41.5~1/RELEASE_X86_64
Binaries:
Node: 16.16.0
npm: 8.16.0
Yarn: N/A
pnpm: N/A
Relevant packages:
next: 12.2.6-canary.8
eslint-config-next: N/A
react: 17.0.2
react-dom: 17.0.2
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
When creating a custom server next js app, if you specify that the app as a whole is an ESM module, it seems to break certain next module import statements. The easiest example is `next/config`. The `next/config` default import, which is supposed to be the `getConfig` function, instead looks like `{ setConfig: [Function: setConfig], default: [Function: _default] }`
### Expected Behavior
Module imports should work as documented.
`import getConfig from 'next/config'` should result in the function which normally is the default export.
### Link to reproduction
https://codesandbox.io/s/loving-black-w7o36d?file=/pages/index.js
### To Reproduce
1. `npx create-next-app --example custom-server-express custom-server-express-app`
2. add "type": "module" to package.json
3. convert `server.js` file to ESM import/export syntax
4. add a `next.config.js` file (using esm syntax) and attempt to use a publicRuntimeConfig value inside a page | https://github.com/vercel/next.js/issues/40159 | https://github.com/vercel/next.js/pull/40224 | a33d502297129602ff1321a2021eaeeab8b895e9 | 8698b4927cdf82773812ae2461919255644945db | "2022-09-01T16:07:34Z" | javascript | "2022-09-06T02:13:56Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 40,072 | ["examples/radix-ui/.gitignore", "examples/radix-ui/README.md", "examples/radix-ui/package.json", "examples/radix-ui/pages/_app.tsx", "examples/radix-ui/pages/index.tsx", "examples/radix-ui/postcss.config.js", "examples/radix-ui/styles/globals.css", "examples/radix-ui/tailwind.config.js", "examples/radix-ui/tsconfig.json"] | [EXAMPLE] Add example NextJS with Radix-UI | ### Describe the feature you'd like to request
Please provide an example of how to use **Radix-UI** with NextJS.
### Describe the solution you'd like
Provide Radix-UI with NextJS
### Describe alternatives you've considered
. | https://github.com/vercel/next.js/issues/40072 | https://github.com/vercel/next.js/pull/41169 | d5837e03cc9a4377c534ea2ccabc54856b6a15f8 | 6e171696f8c067923afaa6afc1245cb4232e3465 | "2022-08-30T01:03:02Z" | javascript | "2022-10-05T14:49:59Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 40,065 | ["packages/next/server/base-server.ts", "packages/next/server/request-meta.ts", "test/production/custom-error-500/index.test.ts"] | Serverless function crashes for custom error page | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
n/a
### What browser are you using? (if relevant)
n/a
### How are you deploying your application? (if relevant)
Vercel
### Describe the Bug
With a local production build, a custom error page works as expected.
On Vercel, `getInitialProps` is called for the custom error component, but the serverless function crashes, exiting with a `Runtime.ExitError` and displaying a Vercel error page to users
```
2022-08-29T21:26:28.231Z 19727b2d-6d1f-49a4-99d6-fe1c36ad4616 ERROR Error: a test error has been manually triggered
at getServerSideProps (/var/task/.next/server/pages/index.js:21:11)
at Object.renderToHTML (/var/task/node_modules/next/dist/server/render.js:512:26)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async doRender (/var/task/node_modules/next/dist/server/base-server.js:638:38)
at async cacheEntry.responseCache.get.isManualRevalidate.isManualRevalidate (/var/task/node_modules/next/dist/server/base-server.js:743:28)
at async /var/task/node_modules/next/dist/server/response-cache/index.js:80:36 {
page: '/'
}
RequestId: 19727b2d-6d1f-49a4-99d6-fe1c36ad4616 Error: Runtime exited with error: exit status 1
Runtime.ExitError
```
```
This Serverless Function has crashed.
Your connection is working correctly.
Vercel is working correctly.
500: INTERNAL_SERVER_ERROR
Code: FUNCTION_INVOCATION_FAILED
ID: cle1::w2g9g-1661808388324-680c9cd47d8a
If you are a visitor, contact the website owner or try again later.
If you are the owner, [learn how to fix the error](https://vercel.com/docs/error/application/FUNCTION_INVOCATION_FAILED) and [check the logs](https://next-500-issue-44av6jqwb-evan-bnbfinderco.vercel.app/_logs).
```
### Expected Behavior
I expect the `getInitialProps` call to succeed, and the custom error component to be rendered successfully by the serverless function.
### Link to reproduction
https://github.com/eprothro/next-500-issue/tree/error-handling-with-404-page
### To Reproduce
1. clone the reproduction repo
2. check out the `error-handling-with-404-page` branch
3. deploy to Vercel
4. visit the index
5. see the `This Serverless Function has crashed` error page
Note that with this example repo, a commit adding a `pages/404.tsx` page introduces the crash. You can check out the `error-handling-no-404-page` branch and deploy to see the custom error component as expected. However, this is likely a red herring, as the application where we're seeing this continues to experience the crash even when the `pages/404.tsx` page is removed. | https://github.com/vercel/next.js/issues/40065 | https://github.com/vercel/next.js/pull/40110 | dddc60df15880fc91478bb75126474e7cd416f7f | 68fb39a034d1b5d7eb8f2af23ca563956f1fa3be | "2022-08-29T21:43:17Z" | javascript | "2022-08-30T23:14:12Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 39,993 | ["packages/next/client/script.tsx", "test/integration/script-loader/base/pages/page10.js", "test/integration/script-loader/strictmode/next.config.js", "test/integration/script-loader/strictmode/pages/onready.js", "test/integration/script-loader/test/index.test.js"] | (next/script) onReady 'Undefined' in Dev, Works in Production | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 22.0.0: Mon Aug 1 06:32:20 PDT 2022; root:xnu-8792.0.207.0.6~26/RELEASE_ARM64_T6000
Binaries:
Node: 16.17.0
npm: 8.15.0
Yarn: 1.22.19
pnpm: N/A
Relevant packages:
next: 12.2.6-canary.5
eslint-config-next: 12.2.5
react: 18.2.0
react-dom: 18.2.0
### What browser are you using? (if relevant)
Brave Version 1.42.97 Chromium: 104.0.5112.102 (Official Build) (arm64)
### How are you deploying your application? (if relevant)
Vercel
### Describe the Bug
When using the onReady method, the external JS is not available and returns undefined when running in dev mode. It works, as expected, in production build (both locally, and on Vercel)
```
<div id="contact-form"></div>
<Script
src="https://www.cognitoforms.com/f/seamless.js"
data-key="Gz67Fka35Eu5U4y5XthVrg"
onReady={() => {
Cognito.mount("216", "#contact-form");
}}
/>
```
### Expected Behavior
External script resources should be loaded and available before onReady fires.
### Link to reproduction
https://github.com/jacobgraf/next-script-onready-issue
### To Reproduce
Run development build and load the page. You will receive an Unhandled Runtime Error - ReferenceError: Cognito is not defined.
If you run a production build, Cognito is available when onReady fires and the form loads, as expected. | https://github.com/vercel/next.js/issues/39993 | https://github.com/vercel/next.js/pull/40002 | afbf4b10e907cbe5d52849a97465c97a0e89371e | e6862e4061e61efa3d51d22703a6cec3b285f395 | "2022-08-27T02:15:11Z" | javascript | "2022-08-28T08:47:55Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 39,952 | ["packages/next/server/base-server.ts", "packages/next/server/request-meta.ts", "test/production/custom-error-500/index.test.ts"] | Serverless function error with custom 500 page | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
N/A
### What browser are you using? (if relevant)
Chrome
### How are you deploying your application? (if relevant)
Vercel
### Describe the Bug
Server side functions that throw an (application level) error result in a `Runtime.ExitError` with `Error: Runtime exited with error: exit status 1` due to a `MissingStaticPage` being thrown.
```
2022-08-25T17:16:19.318Z 99155e5b-28a2-426f-a1bd-fedd6a849c7c ERROR MissingStaticPage [Error]: Failed to load static file for page: /en-US/500 ENOENT: no such file or directory, open '/var/task/.next/server/pages/en-US/500.html'
at /var/task/node_modules/next/dist/server/require.js:55:19
at async Promise.all (index 2)
at async Object.loadComponents (/var/task/node_modules/next/dist/server/load-components.js:53:49)
at async NextNodeServer.findPageComponents (/var/task/node_modules/next/dist/server/next-server.js:451:36)
at async NextNodeServer.renderErrorToResponse (/var/task/node_modules/next/dist/server/base-server.js:1250:26)
at async NextNodeServer.renderToResponse (/var/task/node_modules/next/dist/server/base-server.js:1188:30)
at async NextNodeServer.pipe (/var/task/node_modules/next/dist/server/base-server.js:634:25)
at async Object.fn (/var/task/node_modules/next/dist/server/base-server.js:501:21)
at async Router.execute (/var/task/node_modules/next/dist/server/router.js:222:36)
at async NextNodeServer.run (/var/task/node_modules/next/dist/server/base-server.js:612:29)
2022-08-25T17:16:19.319Z 99155e5b-28a2-426f-a1bd-fedd6a849c7c ERROR Error: a test error has been manually thrown undefined
at getServerSideProps (/var/task/.next/server/pages/test-77af5/server-side-error.js:43:11)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Object.renderToHTML (/var/task/node_modules/next/dist/server/render.js:490:20)
at async doRender (/var/task/node_modules/next/dist/server/base-server.js:908:38)
at async cacheEntry.responseCache.get.isManualRevalidate.isManualRevalidate (/var/task/node_modules/next/dist/server/base-server.js:1013:28)
at async /var/task/node_modules/next/dist/server/response-cache.js:69:36 {
page: '/test-77af5/server-side-error'
}
RequestId: 99155e5b-28a2-426f-a1bd-fedd6a849c7c Error: Runtime exited with error: exit status 1
Runtime.ExitError
```
### Expected Behavior
No error to be thrown by the serverless function.
### Link to reproduction
https://github.com/eprothro/next-500-issue
### To Reproduce
1. Deploy on Vercel
2. Visit the index page
3. View the functions page for the Vercel deployment
4. See the error | https://github.com/vercel/next.js/issues/39952 | https://github.com/vercel/next.js/pull/40110 | dddc60df15880fc91478bb75126474e7cd416f7f | 68fb39a034d1b5d7eb8f2af23ca563956f1fa3be | "2022-08-25T21:24:12Z" | javascript | "2022-08-30T23:14:12Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 39,858 | ["packages/next/build/webpack-config.ts", "test/e2e/edge-render-getserversideprops/index.test.ts"] | `nft.json`s for edge functions are generated at wrong path | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 21.6.0: Wed Aug 10 14:28:23 PDT 2022; root:xnu-8020.141.5~2/RELEASE_ARM64_T6000
Binaries:
Node: 16.14.2
npm: 8.5.0
Yarn: N/A
pnpm: 7.9.3
Relevant packages:
next: 12.2.6-canary.1
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
The `nft.json` files for edge functions are generated under `.next/pages` instead of `.next/server/pages` like non-edge functions.
### Expected Behavior
NA
### Link to reproduction
NA
### To Reproduce
Put
```
export const config = {
runtime: 'experimental-edge',
};
```
in any page and `next build`. The `.next` folder will have the wrong result.
Setting runtime in `next.config.js` won't work as in issue #39800 | https://github.com/vercel/next.js/issues/39858 | https://github.com/vercel/next.js/pull/43304 | 2eaa3ae14651779116ed2ccd5c27a4a9d1d05752 | f4610c31b03085bac27bd82b5945c44a3aa719b0 | "2022-08-23T09:51:33Z" | javascript | "2022-11-24T02:56:11Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 39,853 | ["packages/next/server/api-utils/index.ts", "packages/next/server/api-utils/node.ts", "packages/next/shared/lib/utils.ts", "test/integration/prerender-preview/pages/api/reset.js", "test/integration/prerender-preview/test/index.test.js"] | `clearPreviewData()` doesn't work with custom path | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 21.3.0: Wed Jan 5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_ARM64_T8101
Binaries:
Node: 16.14.2
npm: 8.6.0
Yarn: 1.22.18
pnpm: N/A
Relevant packages:
next: 12.2.5
eslint-config-next: 12.0.4
react: 17.0.2
react-dom: 17.0.2
### What browser are you using? (if relevant)
104.0.5112.101
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
Custom path option for preview mode was added in https://github.com/vercel/next.js/pull/38313 however the `clearPreviewData` method was not updated. Currently, it does not clear the preview mode on custom paths (as it sets the expiry cookie on `/` by default, instead of a custom path specified with `res.setPreviewData`)
A potential fix is to allow `res.clearPreviewData` to accept a path argument on which to expire the Next.js preview mode cookies.
### Expected Behavior
`res.clearPreviewData()` should work on custom paths too
### Link to reproduction
https://codedamn.com/playground/mLua3PAdbeGQLmJZVS5cf
### To Reproduce
1. Open https://codedamn.com/playground/mLua3PAdbeGQLmJZVS5cf
2. Open the embedded iframe view on right in new tab (from top right)
3. Try to set and remove preview mode | https://github.com/vercel/next.js/issues/39853 | https://github.com/vercel/next.js/pull/40238 | 6e2738241fe6b6d2eaae6bcf634e5a20db414ef7 | 6f352357fb432b954930d6aeae890b5e0fd2e6aa | "2022-08-23T08:52:06Z" | javascript | "2022-09-05T20:37:08Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 39,807 | ["packages/next/client/future/image.tsx", "test/integration/image-future/default/pages/static-img.js", "test/integration/image-future/default/test/static.test.ts"] | Could not use `next/future/image` with imported image and fill layout | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
```
Operating System:
Platform: linux
Arch: x64
Version: Ubuntu 20.04.0 LTS Mon Aug 22 2022 11:46:31 GMT+0200 (Central European Summer Time)
Binaries:
Node: 16.14.2
npm: 7.17.0
Yarn: 1.22.10
pnpm: 7.9.4-0
Relevant packages:
next: 12.2.6-canary.1
eslint-config-next: N/A
react: 17.0.1
react-dom: 17.0.1
```
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
When using an imported image and the fill layout with the new image component it throw an error:
```
Error: Image with src "/_next/static/media/bar.ddd5bcf8.svg" has both "width" and "fill" properties. Only one should be used.
```
### Expected Behavior
The [doc](https://nextjs.org/docs/api-reference/next/future/image#fill) seems to allow this use case. So we should be able to use the fill layout with an imported image.
### Link to reproduction
https://stackblitz.com/edit/nextjs-future-image-fill-bug?file=pages/index.js
### To Reproduce
Open the sand box | https://github.com/vercel/next.js/issues/39807 | https://github.com/vercel/next.js/pull/39849 | cb430cce90ec7120dbc6e0e1020a3f42c4b901a4 | 8dfab19d6ede702925340e048649450176d349c9 | "2022-08-22T09:48:58Z" | javascript | "2022-08-23T18:06:44Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 39,706 | ["packages/next/server/serve-static.ts", "test/integration/file-serving/public/vercel-icon-dark.avif", "test/integration/file-serving/test/index.test.js"] | Avif server as octet-stream | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Same problem as for Gatsby: https://github.com/gatsbyjs/gatsby/issues/31068
Or previously Remix: https://github.com/remix-run/remix/issues/3771
### What browser are you using? (if relevant)
Chrome 104, Edge 106
### How are you deploying your application? (if relevant)
Vercel
### Describe the Bug
Wrong mime type for AVIF image from public folder.
### Expected Behavior
Correct Content-Type, so image can be loaded.
### Link to reproduction
https://github.com/pegak/nauc-me-it - you need to have pixel density 2x, run locally and check bg-landing.avif loading :)
### To Reproduce
1. Put AVIF image into public folder.
2. Use that image (I use it from CSS as a background image).
3. Image does not work.
4. Check Network tab in Devtools.
5. Image is loaded, but with type `octet-stream`. | https://github.com/vercel/next.js/issues/39706 | https://github.com/vercel/next.js/pull/39733 | f7eed07945375f0b4a76efcbb5cbfe87072c2261 | 3466862d9dc9c8bb3131712134d38757b918d1c0 | "2022-08-18T00:33:26Z" | javascript | "2022-08-18T17:57:12Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 39,672 | ["packages/next-swc/crates/emotion/src/lib.rs", "packages/next-swc/crates/emotion/tests/fixture/issues/39672/input.tsx", "packages/next-swc/crates/emotion/tests/fixture/issues/39672/output.ts"] | Emotion swc trimmed space in content | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #45~20.04.1-Ubuntu SMP Mon Apr 4 09:38:31 UTC 2022
Binaries:
Node: 14.19.3
npm: 6.14.17
Yarn: 1.22.19
pnpm: N/A
Relevant packages:
next: 12.2.6-canary.0
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
### Describe the Bug
Adding space in content, it is trimmed after compile.

### Expected Behavior
It shouldn't trimmed the space
### Link to reproduction
https://codesandbox.io/s/swc-emotion-problem-forked-4mho3u?file=/pages/index.tsx
### To Reproduce
1. add space inside content (eg: `content: " | "`) | https://github.com/vercel/next.js/issues/39672 | https://github.com/vercel/next.js/pull/39710 | 9c416341048a4467d8bcd147c1d5c399fa1ab17a | 78aefee1c643ed43001b6dbacca73a2bf22aca2a | "2022-08-17T02:13:37Z" | javascript | "2022-08-18T10:02:35Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 39,642 | ["packages/create-next-app/helpers/examples.ts", "test/integration/create-next-app/index.test.ts"] | Found invalid GitHub URL -- Again | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 21.6.0: Sat Jun 18 17:07:22 PDT 2022; root:xnu-8020.140.41~1/RELEASE_ARM64_T6000
Binaries:
Node: 18.7.0
npm: 8.15.0
Yarn: 1.22.18
pnpm: N/A
Relevant packages:
next: 12.2.6-canary.0
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
Vercel
### Describe the Bug
The command
`npx create-next-app -e https://github.com/0xdevnet/juno-dapp-starter/ my-juno-dapp`
returns
`Found invalid GitHub URL: "https://github.com/0xdevnet/juno-dapp-starter/". Please fix the URL and try again.`
I tried also the url `https://github.com/0xkdavid/juno-dapp-starter/` suggested in the Readme with the same result.
This problem has come up before ([here](https://github.com/vercel/next.js/issues/19277) and [here](https://github.com/vercel/next.js/issues/34073)) and they were described as resolved.
### Expected Behavior
I expect the installation to proceed and the "my-juno-dapp" folder to be created.
### Link to reproduction
https://github.com/vercel/next.js/issues/34073
### To Reproduce
Type `npx create-next-app -e https://github.com/0xdevnet/juno-dapp-starter/ my-juno-dapp` in the CLI | https://github.com/vercel/next.js/issues/39642 | https://github.com/vercel/next.js/pull/39665 | 53f0e2b31c1478832811a6d24f391a27b8b07360 | 7fe5c883fcef99e49bffc7e4c83c4206a4ecddbf | "2022-08-16T09:47:49Z" | javascript | "2022-08-17T01:59:32Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 39,609 | ["errors/invalid-dynamic-suspense.md", "packages/next/shared/lib/dynamic.tsx", "test/e2e/dynamic-with-suspense/index.test.ts", "test/integration/next-dynamic-with-suspense/pages/index.js", "test/integration/next-dynamic-with-suspense/pages/thing.js", "test/integration/next-dynamic-with-suspense/test/index.test.ts"] | Dynamic import with suspense:true will disable ssr:false | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 21.6.0: Sat Jun 18 17:07:22 PDT 2022; root:xnu-8020.140.41~1/RELEASE_ARM64_T6000
Binaries:
Node: 16.16.0
npm: 8.11.0
Yarn: 1.22.15
pnpm: 6.11.0
Relevant packages:
next: 12.2.6-canary.0
eslint-config-next: 12.2.5
react: 18.2.0
react-dom: 18.2.0
### What browser are you using? (if relevant)
Chrome 104.0.5112.79
### How are you deploying your application? (if relevant)
yarn dev
### Describe the Bug
```stacktrace
Uncaught Error: window is not defined
at updateDehydratedSuspenseComponent (react-dom.development.js?ac89:20662:1)
at updateSuspenseComponent (react-dom.development.js?ac89:20362:1)
at beginWork (react-dom.development.js?ac89:21624:1)
at beginWork$1 (react-dom.development.js?ac89:27426:1)
at performUnitOfWork (react-dom.development.js?ac89:26557:1)
at workLoopSync (react-dom.development.js?ac89:26466:1)
at renderRootSync (react-dom.development.js?ac89:26434:1)
at performConcurrentWorkOnRoot (react-dom.development.js?ac89:25738:1)
at workLoop (scheduler.development.js?bcd2:266:1)
at flushWork (scheduler.development.js?bcd2:239:1)
at MessagePort.performWorkUntilDeadline (scheduler.development.js?bcd2:533:1)
```
### Expected Behavior
`ssr: false` should work.
### Link to reproduction
It is too easy to reproduce.
### To Reproduce
```javascript
const WarningDomain = dynamic(
() => import("@components/index/warning_domain"),
{ ssr: false, suspense: true }
)
```
It is related to this issue [#36636](https://github.com/vercel/next.js/issues/36636). | https://github.com/vercel/next.js/issues/39609 | https://github.com/vercel/next.js/pull/39676 | 78aefee1c643ed43001b6dbacca73a2bf22aca2a | 53604404130bfc2c9ad9e49164741b6de8a4189b | "2022-08-15T11:56:21Z" | javascript | "2022-08-18T13:53:23Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 39,522 | ["packages/next-swc/crates/core/src/next_dynamic.rs", "packages/next-swc/crates/core/tests/fixture/next-dynamic/template-literal/input.js", "packages/next-swc/crates/core/tests/fixture/next-dynamic/template-literal/output-dev.js", "packages/next-swc/crates/core/tests/fixture/next-dynamic/template-literal/output-prod.js", "packages/next-swc/crates/core/tests/fixture/next-dynamic/template-literal/output-server.js"] | next/dynamic hydrate error | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
```
Operating System:
Platform: win32
Arch: x64
Version: Windows 10 Pro
Binaries:
Node: 16.16.0
npm: N/A
Yarn: N/A
pnpm: N/A
Relevant packages:
next: 12.2.5-canary.7
eslint-config-next: 12.1.0
react: 17.0.2
react-dom: 17.0.2
```
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
```
Warning: Did not expect server HTML to contain a <div> in <div>.
at div
at Homepage (webpack-internal:///./pages/index.js:21:26)
at MyApp (webpack-internal:///./pages/_app.js:21:27)
at ErrorBoundary (webpack-internal:///./node_modules/next/dist/compiled/@next/react-dev-overlay/dist/client.js:8:20740)
at ReactDevOverlay (webpack-internal:///./node_modules/next/dist/compiled/@next/react-dev-overlay/dist/client.js:8:23632)
at Container (webpack-internal:///./node_modules/next/dist/client/index.js:71:9)
at AppContainer (webpack-internal:///./node_modules/next/dist/client/index.js:588:26)
at Root (webpack-internal:///./node_modules/next/dist/client/index.js:699:27)
```
### Expected Behavior
no error no warning
### Link to reproduction
https://github.com/Capricair/next-dynamic-issue
### To Reproduce
1. code
```
// homepage
import dynamic from "next/dynamic"
const Test = dynamic(() => import(`/components/test`))
function Homepage() {
return (
<div>
<Test />
</div>
)
}
export default Homepage
```
```
// test component
function Test(){
return <div>Test Component</div>
}
export default Test
```
2. npm run dev
3. open homepage

| https://github.com/vercel/next.js/issues/39522 | https://github.com/vercel/next.js/pull/39623 | 6876bb4c44ba44f74c940dbd556651448bfc34c1 | 3f63a491d05e7e562639a03915cfcd0da06d1557 | "2022-08-12T03:16:33Z" | javascript | "2022-08-16T11:48:16Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 39,495 | ["packages/next/server/dev/next-dev-server.ts", "test/integration/api-support/pages/api/auth/[...nextauth].js", "test/integration/api-support/test/index.test.js"] | [CLIENT_FETCH_ERROR] with next-auth and v12.2.5-canary.4 | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 20.6.0: Tue Feb 22 21:10:42 PST 2022; root:xnu-7195.141.26~1/RELEASE_ARM64_T8101
Binaries:
Node: 16.15.1
npm: 8.11.0
Yarn: N/A
pnpm: 7.6.0
Relevant packages:
next: 12.2.5-canary.4
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
When trying to login, an error appears. Not happening in earlier canary versions. (can only repro in v12.2.5-canary.4)
```
{
"error": {
"message": "Unexpected token '<', \"<!DOCTYPE \"... is not valid JSON",
"stack": "SyntaxError: Unexpected token '<', \"<!DOCTYPE \"... is not valid JSON",
"name": "SyntaxError"
},
"url": "/api/auth/session",
"message": "Unexpected token '<', \"<!DOCTYPE \"... is not valid JSON",
"client": true
}
```
ref: https://github.com/nextauthjs/next-auth/issues/5008#issuecomment-1211666440
### Expected Behavior
To be able to login
### Link to reproduction
https://github.com/awareness481/next-auth-v12.2.5-canary.4
### To Reproduce
1. Clone https://github.com/awareness481/next-auth-v12.2.5-canary.4 (next-auth example with canary version)
2. Install deps
3. Try to login
4. Observe error
(Edit: If you dont have at least one provider setup, you ll get a different error message but it is irrelevant) | https://github.com/vercel/next.js/issues/39495 | https://github.com/vercel/next.js/pull/39504 | f863ba719376dab64acf9f8c3ffd62cb87ddeb42 | d158c0c5804b0af747fba321b34b137f0b345845 | "2022-08-11T12:05:49Z" | javascript | "2022-08-11T15:09:57Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 39,411 | ["packages/next/server/base-server.ts", "packages/next/server/dev/next-dev-server.ts", "packages/next/server/dev/on-demand-entry-handler.ts", "packages/next/server/next-server.ts", "packages/next/server/router.ts", "test/e2e/edge-vs.-non-edge-api-route-priority/index.test.ts", "test/lib/next-test-utils.js"] | Nextjs route matching doesn't match in vercel but does locally | ### Verify canary release
- [x] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #653-Microsoft Wed Apr 27 16:06:00 PST 2022
Binaries:
Node: 17.3.0
npm: 8.3.0
Yarn: 1.22.18
pnpm: N/A
Relevant packages:
next: 12.2.2
eslint-config-next: 12.2.2
react: 18.2.0
react-dom: 18.2.0
### What browser are you using? (if relevant)
Chrome 104.0.5112.81
### How are you deploying your application? (if relevant)
Vercel
### Describe the Bug
When having a simple file system route like such
/pages
- /api
- /user
- [id].ts
- login.ts
I've noticed that when running the following configuration locally it works fine. and even when running `yarn build && yarn start` it still works fine. But when running on vercel. I always get the following error

You will see that the path is being matched to the [id] field and not the login field. But when run locally

which is extremely odd. A piece of useful information may be that [id].ts is an edge function while login.ts is a serverless function.
### Expected Behavior
/api/user/login should match to login.ts and not [id].ts in vercel.
### Link to reproduction
None
### To Reproduce
```
npx create-next-app my-app
```
```js
// /api/user/login.ts
export default async function handler(req, res) {
res.json({hello: 'world'});
}
```
```js
// /api/user/[id].ts
export const config = {
runtime: 'experimental-edge',
};
export default async function handler(req) {
return new Response('Hello World');
}
```
```
npx vercel
```
| https://github.com/vercel/next.js/issues/39411 | https://github.com/vercel/next.js/pull/39462 | 57b6eff904a53784d08d284382945b93b082df02 | 7de3cf5f8962f28ff667aedeb2331c4b0a33ee65 | "2022-08-09T06:43:23Z" | javascript | "2022-08-16T18:05:03Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 39,396 | ["packages/next/build/analysis/get-page-static-info.ts", "test/e2e/middleware-matcher/index.test.ts"] | Middleware matcher does not match / for TrailingSlash: true + i18n | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #45~20.04.1-Ubuntu SMP Mon Apr 4 09:38:31 UTC 2022
Binaries:
Node: 14.19.3
npm: 6.14.17
Yarn: 1.22.19
pnpm: N/A
Relevant packages:
next: 12.2.4
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
It seems like the middleware `matcher` does not match the homepage route / if `trailingSlash` is set to `true` along with some i18n config.
next.config.js
```
trailingSlash: true,
i18n: {
locales: ["us", "uk", "eu"],
defaultLocale: "us",
localeDetection: false
}
```
along with the following middleware matcher
```
export const config = {
matcher: "/"
};
```
### Expected Behavior
When matcher is set to `"/"` the middleware should kick in on the homepage.
### Link to reproduction
https://codesandbox.io/s/serene-morning-fd1cr1?file=/middleware.ts
### To Reproduce
- Load the reproduction example
- Make sure you are on the homepage /
- Refresh app
- Look at the terminal logs, nothing is logged even though middleware.ts has a `console.log` in there | https://github.com/vercel/next.js/issues/39396 | https://github.com/vercel/next.js/pull/39397 | e2119c068f5dc7533032749e42a3b4d891abb091 | 15a216b856fea556e129f234299bfedc7bd58f0b | "2022-08-08T15:00:05Z" | javascript | "2022-08-09T22:58:40Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 39,386 | ["packages/next/build/swc/options.js"] | Emotion SWC compiler ignores `sourceMap` option | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
```
Operating System:
Platform: linux
Arch: x64
Version: #112-Ubuntu SMP Thu Feb 3 13:50:55 UTC 2022
Binaries:
Node: 14.19.3
npm: 6.14.17
Yarn: 1.22.19
pnpm: N/A
Relevant packages:
next: 12.2.4
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
```
### What browser are you using? (if relevant)
104.0.5112.79
### How are you deploying your application? (if relevant)
Codesandbox
### Describe the Bug
It seems that the SWC compiler for Emotion is ignoring the settings passed into it, for example the `sourcemap` option. I have explicitly disabled it (we intend to disable it in dev for internal reasons occasionally) but it seems to still be generating a source map regardless:
<img width="800" alt="Screenshot 2022-08-07 at 20 07 45" src="https://user-images.githubusercontent.com/5593067/183304983-9a3d38ef-e931-4879-9949-a757a87624bc.png">
The config in `next.config.js` is as follow:
```
/** @type {import("next").NextConfig} */
const config = {
compiler: {
emotion: {
sourceMap: false,
autoLabel: "never"
}
}
};
module.exports = config;
```
***
Codesandbox link: https://codesandbox.io/s/admiring-ully-gw1grk
Live page: https://gw1grk.sse.codesandbox.io/
### Expected Behavior
No sourcemap should be expected in the `<style>` tags, as it has been explicitly turned off in the `compiler.emotion` option.
### Link to reproduction
https://codesandbox.io/s/admiring-ully-gw1grk
### To Reproduce
1. Go to the code sandbox link: https://codesandbox.io/s/admiring-ully-gw1grk
2. Notice that sourcemap is explicitly disabled in the NextJS config
3. Load the live page: https://gw1grk.sse.codesandbox.io/
4. Inspect the source on the live page, and notice that source maps are still being injected into the `<style>` tags:5.
<img width="800" alt="Screenshot 2022-08-07 at 20 07 45" src="https://user-images.githubusercontent.com/5593067/183305034-9a270887-236b-45c6-b8ac-ba98885809aa.png">
| https://github.com/vercel/next.js/issues/39386 | https://github.com/vercel/next.js/pull/39389 | 8ddcc6aedb6dcd424ff0e44c8d47450ae77a3723 | 4da09da1a2fa0c7b2d9c558b8072dfdd00a4b369 | "2022-08-07T18:11:33Z" | javascript | "2022-08-08T02:52:44Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 39,383 | ["examples/progressive-web-app/package.json"] | PWA example broken | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #1 SMP PREEMPT Mon Jun 27 10:02:42 UTC 2022
Binaries:
Node: 18.4.0
npm: 8.12.1
Yarn: 1.22.19
pnpm: 7.9.0
Relevant packages:
next: 12.2.4
eslint-config-next: N/A
react: 17.0.2
react-dom: 17.0.2
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
Starting the Progressive Web App example gives the error `TypeError: ServiceWorker script at http://localhost:3000/sw.js for scope http://localhost:3000/ encountered an error during installation.`
### Expected Behavior
Working application.
### Link to reproduction
http://no-reproduction-example.com
### To Reproduce
```
git clone [email protected]:vercel/next.js.git
cd next.js/examples/progressive-web-app
npm i
npm run dev
``` | https://github.com/vercel/next.js/issues/39383 | https://github.com/vercel/next.js/pull/39369 | 43a4a8e6a6fd1ebd42769dc2b24f63fb8b89e9b6 | b1de1d10782657bf7412160f2b88314c690e3e8c | "2022-08-07T13:32:45Z" | javascript | "2022-08-07T15:25:47Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 39,321 | ["packages/create-next-app/helpers/examples.ts"] | Can't install sample project | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
```
% npx --no-install next info
npm ERR! canceled
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/username/.npm/_logs/2022-08-04T11_46_58_425Z-debug-0.log
```
OS: MacOS Monterey 12.5
npm: 8.15.0
Node.js: 18.7.0
### Which example does this report relate to?
blog-starter
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
Trouble with first install with `npx create-next-app --example blog-starter`.
Error message is this.
```
Downloading files for example blog-starter. This might take a moment.
? Could not download "blog-starter" because of a connectivity issue between your machine and GitHub.
✔ Could not download "blog-starter" because of a connectivity issue between your machine and GitHub.
Do you want to use the default template instead? … no
Aborting installation.
Unexpected error. Please report it as a bug:
DownloadError: Premature close
at createApp (/Users/username/.npm/_npx/efeac22998af9bf2/node_modules/create-next-app/dist/index.js:317:17028)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async run (/Users/username/.npm/_npx/efeac22998af9bf2/node_modules/create-next-app/dist/index.js:317:23064)
```
### Expected Behavior
It worked fine when the Node version was 16.16.0.
In 18.7.0, I think there is a bug around the sample installation.
### To Reproduce
OS: MacOS Monterey 12.5
```
$ brew install n
$ sudo n latest
// latest version is 18.7.0
$ sudo n use
> 18.7.0
$ npx create-next-app --example blog-starter blog-starter-app
``` | https://github.com/vercel/next.js/issues/39321 | https://github.com/vercel/next.js/pull/40182 | 591321e8826e35a6bbc1a8580a9b0fb25f4645b8 | 5a04e82ba9ea96e9f6fae8ac096e05f0196c25e0 | "2022-08-04T12:19:28Z" | javascript | "2022-09-05T16:11:12Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 39,317 | ["packages/next/server/image-optimizer.ts", "packages/next/types/misc.d.ts", "test/integration/image-optimizer/app/pages/index.js", "test/integration/image-optimizer/test/index.test.ts", "test/integration/image-optimizer/test/old-sharp.test.ts", "test/integration/image-optimizer/test/sharp.test.ts", "test/integration/image-optimizer/test/squoosh.test.ts", "test/integration/image-optimizer/test/util.ts"] | Animated WebP images work in development but not when building | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
```
Operating System:
Platform: linux
Arch: x64
Version: #1 SMP PREEMPT_DYNAMIC Fri, 15 Jul 2022 15:33:02 +0000
Binaries:
Node: 16.16.0
npm: 8.11.0
Yarn: 1.22.19
pnpm: N/A
Relevant packages:
next: 12.2.4-canary.11
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
```
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
1. When I run `yarn dev` and open http://localhost:3000/, I can see the animated image of the cat.
2. However, when I run `yarn build` I get the following error.
```
Failed to compile.
./assets/cat.webp
TypeError: Cannot read properties of null (reading 'width')
at Object.processBuffer (/home/aaditmshah/Repositories/animated-webp-static-import-bug/node_modules/next/dist/server/lib/squoosh/main.js:64:46)
at async Object.resizeImage (/home/aaditmshah/Repositories/animated-webp-static-import-bug/node_modules/next/dist/server/image-optimizer.js:619:21)
at async Span.traceAsyncFn (/home/aaditmshah/Repositories/animated-webp-static-import-bug/node_modules/next/dist/trace/trace.js:79:20)
at async /home/aaditmshah/Repositories/animated-webp-static-import-bug/node_modules/next/dist/build/webpack/loaders/next-image-loader.js:52:38
at async Span.traceAsyncFn (/home/aaditmshah/Repositories/animated-webp-static-import-bug/node_modules/next/dist/trace/trace.js:79:20)
Import trace for requested module:
./pages/index.tsx
> Build failed because of webpack errors
```
### Expected Behavior
* When I run `yarn build` the Next.js app should build without any errors.
* After that, if I run `yarn start` and open http://localhost:3000/, I should see the animated image of the cat.
### Link to reproduction
https://github.com/aaditmshah/animated-webp-static-import-bug
### To Reproduce
1. Install the dependencies using `yarn install`.
2. Run `yarn dev` and open http://localhost:3000/ to see the animated image of the cat.
3. Run `yarn build` to see the aforementioned build error. | https://github.com/vercel/next.js/issues/39317 | https://github.com/vercel/next.js/pull/39325 | 442378d21dd56d6e769863eb8c2cb521a463a2e0 | d008f655bce55f9d9f4cf63be4b7441e80262529 | "2022-08-04T06:16:58Z" | javascript | "2022-08-05T21:28:17Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 39,312 | ["packages/next/server/image-optimizer.ts", "test/integration/image-optimizer/test/util.js"] | passing random urls starting with / to _next/image causes 500 internal server errors | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Binaries:
Node: 14.19.3
npm: 6.14.17
Yarn: N/A
pnpm: N/A
Relevant packages:
next: 12.2.3
eslint-config-next: 12.2.3
react: 18.2.0
react-dom: 18.2.0
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
create a new next app using create-next-app, build and run server locally
visit http://localhost:3000/_next/image?url=/testing/&w=256&q=75 and you will receive a 500 error with this message:
`Unable to optimize image and unable to fallback to upstream image`
This also happens in production. Any Url that starts with / will cause this error.
This was introduced by this pull request: https://github.com/vercel/next.js/pull/34899/files
### Expected Behavior
This should return a 400 or 404 error and not a 500 error.
### Link to reproduction
https://stackblitz.com/edit/vercel-next-js-ceaw9w?file=README.md
### To Reproduce
visit https://vercel-next-js-ceaw9w--3000.local.webcontainer.io/_next/image?url=/testing/&w=256&q=75 in the stackblitz link | https://github.com/vercel/next.js/issues/39312 | https://github.com/vercel/next.js/pull/39334 | b4027875e769189b823d98619e0f7c5651c4ad14 | 869a2fe881d56bf808af3786f160921e337b0220 | "2022-08-04T01:57:45Z" | javascript | "2022-08-05T02:36:21Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 39,311 | [".github/workflows/build_test_deploy.yml"] | New Project - jemalloc: Unsupported system page size | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
npx --no-install next info
Operating System:
Platform: linux
Arch: arm64
Version: #2 SMP Mon Jun 13 21:08:46 PDT 2022
Binaries:
Node: 18.7.0
npm: 8.15.0
Yarn: 1.22.19
pnpm: N/A
Relevant packages:
next: 12.2.4-canary.11
eslint-config-next: 12.2.3
react: 18.2.0
react-dom: 18.2.0
Other infos:
Image: Oracle-Linux-8.6-aarch64-2022.06.30-0 (CentOS based distro)
uname -a:
Linux virtualmachine 5.4.17-2136.308.9.el8uek.aarch64 #2 SMP Mon Jun 13 21:08:46 PDT 2022 aarch64 aarch64 aarch64 GNU/Linux
### What browser are you using? (if relevant)
Not relevant
### How are you deploying your application? (if relevant)
yarn dev
### Describe the Bug
When I run the project(freshly created) it does not start, instead the following output is given:
```bash
yarn run v1.22.19
$ next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info - SWC minify release candidate enabled. https://nextjs.link/swcmin
<jemalloc>: Unsupported system page size
<jemalloc>: Unsupported system page size
memory allocation of 10 bytes failed
error Command failed with signal "SIGABRT".
```
Complementary info:
```sh
$ getconf PAGESIZE
65536(64k)
```
I've found this [issue](https://github.com/fluent/fluent-bit/issues/4270) thats seems to be the same problem in a docker project(not related to next.js), not sure if can be of any help.
### Expected Behavior
The project start with the default next.js page
### Link to reproduction
https://github.com/Jao8/projects-hub
### To Reproduce
```sh
yarn create next-app --typescript <project-name>;
yarn dev;
``` | https://github.com/vercel/next.js/issues/39311 | https://github.com/vercel/next.js/pull/41229 | 5d7d7391e0c86d446f863027727fb12f21e91330 | de8ae7313f9b4cf84825ed1e330976427dc10fc8 | "2022-08-04T01:15:38Z" | javascript | "2022-10-12T06:13:06Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 39,275 | ["packages/next/build/webpack-config.ts", "test/e2e/edge-render-getserversideprops/index.test.ts"] | Standalone mode and `experimental-edge` API route shows trace warning | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 21.3.0: Wed Jan 5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_ARM64_T8101
Binaries:
Node: 18.4.0
npm: 8.13.1
Yarn: N/A
pnpm: N/A
Relevant packages:
next: 12.2.4-canary.9
eslint-config-next: 12.2.4-canary.9
react: 18.2.0
react-dom: 18.2.0
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
When `output: "standalone"` in next.config.js and `runtime: "experimental-edge"` in API Routes are enabled, `next build` will display the following error in the terminal.
```sh
> Build error occurred
[Error: ENOENT: no such file or directory, open '/sandbox/.next/server/pages/api/hello.js.nft.json'] {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/sandbox/.next/server/pages/api/hello.js.nft.json'
}
```
Looking in the .next directory, this path does not exist, but apparently `.next/pages/api/hello.js.nft.json` does.
### Expected Behavior
Output file paths by Edge API Routes are correctly provided in standalone.
### Link to reproduction
https://codesandbox.io/s/quizzical-breeze-ipms0m
### To Reproduce
1. add `output: "standalone"` to `next.config.json`
2. create `pages/api/*.ts` like [Edge API Routes basic example](https://nextjs.org/docs/api-routes/edge-api-routes#basic)
3. run `next build` | https://github.com/vercel/next.js/issues/39275 | https://github.com/vercel/next.js/pull/43304 | 2eaa3ae14651779116ed2ccd5c27a4a9d1d05752 | f4610c31b03085bac27bd82b5945c44a3aa719b0 | "2022-08-03T02:40:04Z" | javascript | "2022-11-24T02:56:11Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 39,262 | ["packages/next/server/body-streams.ts", "test/e2e/middleware-fetches-with-body/index.test.ts", "test/production/reading-request-body-in-middleware/index.test.ts"] | Presence of middleware prevents access to raw request bodies greater than or equal to 16,384 bytes (16 KiB) | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
```
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 21.6.0: Sat Jun 18 17:07:22 PDT 2022; root:xnu-8020.140.41~1/RELEASE_ARM64_T6000
Binaries:
Node: 18.7.0
npm: 8.15.0
Yarn: 1.22.19
pnpm: 7.8.0
Relevant packages:
next: 12.2.4-canary.9
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
```
### What browser are you using? (if relevant)
N/A
### How are you deploying your application? (if relevant)
N/A
### Describe the Bug
When attempting to upload a file over a few kilobytes (e.g. sending a `POST` request with a binary body and a `Content-Type` of `multipart/form-data`) via `fetch` or `curl`, the request stalls, then fails with the error:
```
error - Error: aborted
at connResetException (node:internal/errors:704:14)
at abortIncoming (node:_http_server:700:17)
at socketOnClose (node:_http_server:694:3)
at Socket.emit (node:events:525:35)
at TCP.<anonymous> (node:net:757:14) {
middleware: true
}
```
This occurs only for API pages with…
```TS
export const config = {
api: {
bodyParser: {
bodyParser: false,
},
},
}
```
…*and* only when middleware is present; even something as basic as:
```TS
import {NextRequest, NextResponse} from "next/server"
export async function middleware(req: NextRequest) {
return NextResponse.next()
}
```
Removing the middleware fixes the issue. Of note, very small request bodies (e.g. < 1kb files) work even in the presence of middleware.
### Expected Behavior
Sending a POST request to an API endpoint with a Content-Type of `multipart/form-data` along with a reasonably sized (~200kB) binary payload should work and not stall.
### Link to reproduction
https://github.com/jhahn/nextjs-upload-issue
### To Reproduce
`pages/index.tsx`
```TSX
import type { NextPage } from 'next'
import Head from 'next/head'
import Image from 'next/image'
import styles from '../styles/Home.module.css'
const Home: NextPage = () => {
const uploadFile = async (files: FileList | null) => {
if (!files) return
const formData = new FormData()
formData.append("file", files[0])
const response = await fetch("/api/hello", {
method: "POST",
body: formData,
})
console.log(await response.json())
}
return <input type="file" onChange={(e) => uploadFile(e.target.files)} />
}
export default Home
```
`pages/api/hello.ts`:
```TS
import type { Readable } from 'node:stream';
import type { NextApiRequest, NextApiResponse } from 'next'
export const config = {
api: {
bodyParser: {
bodyParser: false,
},
},
}
async function buffer(readable: Readable) {
const chunks = [];
for await (const chunk of readable) {
chunks.push(typeof chunk === 'string' ? Buffer.from(chunk) : chunk);
}
return Buffer.concat(chunks);
}
export default async function (req: NextApiRequest, res: NextApiResponse) {
if (req.method === 'POST') {
const buf = await buffer(req.body);
const rawBody = buf.toString('utf8');
// Can do something here...
res.json({ rawBody });
} else {
res.setHeader('Allow', 'POST');
res.status(405).end('Method Not Allowed');
}
}
```
The code for `pages/api/hello.ts` was adapted from https://vercel.com/support/articles/how-do-i-get-the-raw-body-of-a-serverless-function. However, I had to change `const buf = await buffer(req);` to `const buf = await buffer(req.body);` | https://github.com/vercel/next.js/issues/39262 | https://github.com/vercel/next.js/pull/41270 | ec94e68cc74bf1b0fd53c86ae2651484c0165854 | 6249307b75ebd21bbf86895cde177d8c6f82fe94 | "2022-08-02T17:10:07Z" | javascript | "2022-10-17T22:26:16Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 39,194 | ["docs/testing.md"] | Docs: Playwright e2e sample test fails | ### What is the improvement or update you wish to see?
[Playwright e2e docs](https://nextjs.org/docs/testing#creating-your-first-playwright-end-to-end-test) fail to pass the sample test. This test should pass.
### Is there any context that might help us understand?
The test fails because of the following code:
In pages/index.js, the text says "About"
```
<Link href="/about">
<a>About</a>
</Link>
```
But the test in e2e/example.spec.ts is looking for an element with the text "About Page"
```
// Find an element with the text 'About Page' and click on it
await page.click('text=About Page')
```
The solution would be to either have the text in pages/index.js say "About Page" or the test in e2e/example.spec.ts check for 'text=About'
### Does the docs page already exist? Please link to it.
https://nextjs.org/docs/testing#creating-your-first-playwright-end-to-end-test | https://github.com/vercel/next.js/issues/39194 | https://github.com/vercel/next.js/pull/39195 | e42c88d8a9a2a6d9dd49d9a8db05c96069fe15be | de6fc1cf359b94f4133909b3b86dd1910b8435f9 | "2022-07-31T02:04:52Z" | javascript | "2022-07-31T15:30:38Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 39,090 | ["packages/next-swc/Cargo.lock"] | 12.2.3 Compiled code is not ES5 | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.2.0: Sun Nov 28 20:28:41 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T6000
Binaries:
Node: 14.19.1
npm: 6.14.16
Yarn: 1.22.19
pnpm: N/A
Relevant packages:
next: 12.2.3
eslint-config-next: 12.2.3
react: 18.2.0
react-dom: 18.2.0
### Which example does this report relate to?
no template, just create-next-app
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
We use [es-check](https://github.com/yowainwright/es-check) to make sure that our compiled code is ES5 compatible. In previous versions, we have been able to run this check on files in `.next/static/`. However, when using NextJS v12.2.3 these checks fail.
Running the check for ES6 passes.
### Expected Behavior
I expect files compiled by NextJS using SWC to be ES5 compatible. [See this line](https://github.com/vercel/next.js/blob/84fcbd56bcb9b18e27ee57d0f7f9ba43fe0a13e9/packages/next/build/swc/options.js#L247-L248)
### To Reproduce
Commands
```shell
# Create a NextJS application using:
yarn create next-app
# Install es-check"
yarn add --dev es-check
#Run a build:
yarn build
#Check compiled files for ES5:
yarn run es-check es5 '.next/static/**/*.js'
```
Error:
```
error: ES-Check: there were 1 ES version matching errors.
info:
ES-Check Error:
----
· erroring file: .next/static/chunks/framework-f99e4e38d5204d9a.js
· error: SyntaxError: Unexpected token (11:7018)
· see the printed err.stack below for context
----
SyntaxError: Unexpected token (11:7018)
at Parser.pp$4.raise (/Users/genarorg/work/scratch/nextjs-upgrade-2/node_modules/acorn/dist/acorn.js:3459:15)
at Parser.pp$9.unexpected (/Users/genarorg/work/scratch/nextjs-upgrade-2/node_modules/acorn/dist/acorn.js:760:10)
at Parser.pp$9.semicolon (/Users/genarorg/work/scratch/nextjs-upgrade-2/node_modules/acorn/dist/acorn.js:737:68)
at Parser.pp$8.parseDoStatement (/Users/genarorg/work/scratch/nextjs-upgrade-2/node_modules/acorn/dist/acorn.js:997:14)
at Parser.pp$8.parseStatement (/Users/genarorg/work/scratch/nextjs-upgrade-2/node_modules/acorn/dist/acorn.js:896:35)
at Parser.pp$8.parseIfStatement (/Users/genarorg/work/scratch/nextjs-upgrade-2/node_modules/acorn/dist/acorn.js:1065:28)
at Parser.pp$8.parseStatement (/Users/genarorg/work/scratch/nextjs-upgrade-2/node_modules/acorn/dist/acorn.js:907:35)
at Parser.pp$8.parseBlock (/Users/genarorg/work/scratch/nextjs-upgrade-2/node_modules/acorn/dist/acorn.js:1236:23)
at Parser.pp$8.parseStatement (/Users/genarorg/work/scratch/nextjs-upgrade-2/node_modules/acorn/dist/acorn.js:918:38)
at Parser.pp$8.parseIfStatement (/Users/genarorg/work/scratch/nextjs-upgrade-2/node_modules/acorn/dist/acorn.js:1065:28)
``` | https://github.com/vercel/next.js/issues/39090 | https://github.com/vercel/next.js/pull/39158 | cf729edc9d1e3b0d36e20087e360663b69160cc7 | eb0e161f2e00556686b5288b3cc8f188276958bc | "2022-07-28T01:46:16Z" | javascript | "2022-07-29T03:26:28Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 39,062 | ["examples/with-docker-compose/next-app/prod-without-multistage.Dockerfile", "examples/with-docker-compose/next-app/prod.Dockerfile", "examples/with-docker-multi-env/docker/development/Dockerfile", "examples/with-docker-multi-env/docker/production/Dockerfile", "examples/with-docker-multi-env/docker/staging/Dockerfile", "examples/with-docker/Dockerfile"] | docker build RUN yarn build Error: Call retries were exceeded | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 20.5.0: Sat May 8 05:10:33 PDT 2021; root:xnu-7195.121.3~9/RELEASE_X86_64
Binaries:
Node: 14.16.1
npm: 6.14.12
Yarn: 1.22.11
pnpm: N/A
Relevant packages:
next: 12.2.3
eslint-config-next: 12.2.3
react: 18.2.0
react-dom: 18.2.0
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
when i run yarn build its success
but when i run ” docker build “ Execute to yarn build ,i have this problem
i try to run yarn add --dev typescript @types/node
and try to add this code in next.config.js but the problem remains 。
```
typescript: {
ignoreBuildErrors: true
}
```

### Expected Behavior
docker build success
### Link to reproduction
no
### To Reproduce
when i run yarn build its success
but when i run ” docker build “ Execute to yarn build ,i have this problem
my docker file
```
# Install dependencies only when needed
FROM node:16-alpine AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app
# Install dependencies based on the preferred package manager
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
RUN \
[ -f yarn.lock ] && yarn --frozen-lockfile --prod || \
# [ -f package-lock.json ] && npm ci || \
# [ -f pnpm-lock.yaml ] && yarn global add pnpm && pnpm fetch --prod && pnpm i -r --offline --prod || \
(echo "Lockfile not found." && exit 1)
# Rebuild the source code only when needed
FROM node:16-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry during the build.
# ENV NEXT_TELEMETRY_DISABLED 1
RUN yarn build
# If using npm comment out above and use below instead
# RUN npm run build
# Production image, copy all the files and run next
FROM node:16-alpine AS runner
WORKDIR /app
ENV NODE_ENV production
# Uncomment the following line in case you want to disable telemetry during runtime.
# ENV NEXT_TELEMETRY_DISABLED 1
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
# You only need to copy next.config.js if you are NOT using the default configuration
# COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/package.json ./package.json
# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
USER nextjs
EXPOSE 4001
ENV PORT 4001
CMD ["node", "server.js"]
```
i try to run yarn add --dev typescript @types/node
and try to add this code in next.config.js but the problem remains 。
```
typescript: {
ignoreBuildErrors: true
}
``` | https://github.com/vercel/next.js/issues/39062 | https://github.com/vercel/next.js/pull/39072 | 0ebd53fdb55cc60ef7e20ce5a9b5b0fb0fb21abd | 0a781dd67510b679db178b17e30a1a06bb912398 | "2022-07-27T10:22:27Z" | javascript | "2022-07-27T14:54:04Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 39,057 | ["packages/next/pages/_document.tsx", "test/e2e/prerender.test.ts", "test/e2e/prerender/pages/blocking-fallback/[slug].js"] | Show exact name of page in build output for dynamic catch all route | ### Describe the feature you'd like to request
At the moment, when you create a build of your next.js project, and you have a dynamic catch all route (for example [[...slug]].tsx), the name in the output is also displayed as [[...slug]].
See example below
Warning: data for page "/[[...slug]]" is 283 kB which exceeds the threshold of 128 kB, this amount of data can reduce performance.
See more info here: https://nextjs.org/docs/messages/large-page-data
Warning: data for page "/[[...slug]]" is 299 kB which exceeds the threshold of 128 kB, this amount of data can reduce performance.
See more info here: https://nextjs.org/docs/messages/large-page-data
### Describe the solution you'd like
I would like to see the exact name of the page in the output, so I know which page to investigate
### Describe alternatives you've considered
not applicable | https://github.com/vercel/next.js/issues/39057 | https://github.com/vercel/next.js/pull/39071 | 0a781dd67510b679db178b17e30a1a06bb912398 | 34f5236f572b9f6a2e3c55a537a6a717ffaae71d | "2022-07-27T07:45:38Z" | javascript | "2022-07-27T15:15:37Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 39,049 | ["packages/next/shared/lib/router/router.ts", "test/e2e/middleware-rewrites/app/middleware.js", "test/e2e/middleware-rewrites/test/index.test.ts"] | middleware causes infinite refresh loop with dynamic getStaticProps page deployed to vercel | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 21.2.0: Sun Nov 28 20:28:41 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T6000
Binaries:
Node: 16.15.0
npm: 8.5.5
Yarn: 1.22.19
pnpm: 7.0.0-rc.7
Relevant packages:
next: 12.2.4-canary.2
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
### What browser are you using? (if relevant)
Brave 1.41.100 Chromium: 103.0.5060.134 (Official Build) (arm64)
### How are you deploying your application? (if relevant)
Vercel
### Describe the Bug
Defining any middleware (even an empty middleware function) with a dynamic gsp page causes the page to rapidly refresh when deployed on Vercel
### Expected Behavior
The page should load without entering an infinite refresh loop.
### Link to reproduction
https://github.com/bryanrsmith/i18n-app
### To Reproduce
1. `npx create-next-app --example i18n-routing i18n-app`
2. Define an empty middleware function, `export function middleware(request) { return NextResponse.next();}`
3. Deploy the app to Vercel (I have deployed it to https://i18n-app-middleware.vercel.app/)
4. Visit `/gsp/first`
The page rapidly reloads in a loop. | https://github.com/vercel/next.js/issues/39049 | https://github.com/vercel/next.js/pull/39086 | 600bdb1eb56cf6c5790a6db4e90036a7df3cfe9c | 3a31b96f265ed8229d09ed46fff7b18f6b3ab9b7 | "2022-07-26T22:07:41Z" | javascript | "2022-07-28T00:52:56Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 39,035 | ["packages/next/client/future/image.tsx", "test/integration/image-future/base-path/test/static.test.js", "test/integration/image-future/default/test/index.test.js", "test/integration/image-future/default/test/static.test.js"] | Broken blurDataURL after ~12.2.1 patch | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:37 PDT 2022; root:xnu-8020.121.3~4/RELEASE_ARM64_T6000
Binaries:
Node: 16.16.0
npm: 8.11.0
Yarn: 1.22.17
pnpm: N/A
Relevant packages:
next: 12.2.3
eslint-config-next: 12.2.0
react: 18.2.0
react-dom: 18.2.0
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
next start, next dev
### Describe the Bug
Hello.
I found the bug with difference between next dev and next start in image/future (i guess result shouldn't be different to be sure i will ship app as i want to ship):
When i deploy my app or just build then start - blur images makes me scarry and flicker on millisecond because alpha channel doesn't work. Only gaussian:

Horever, when i start the dev server, bug doesn't represents and blurred image looks as it should looks.
Finally, dev and runned ssr generates different blur images:
Dev: /_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fsplash.8cb7b12d.webp&w=8&q=70
Start: data:image/webp;base64,UklGRrgAAABXRUJQVlA4WAoAAAAQAAAABwAABAAAQUxQSCkAAAAAAAAJPwAxYAACABDnfI3bCAA3AHL79/8/AFW9693/wkIAAHhVSYkmMABWUDggaAAAAHACAJ0BKggABQACQDglsAJ0MEW/W79QAXECE4AA/spO0RQ0tGMgbY5zIa1mKEyF8zmfDfbxDSyWiqGvM5zXun/5/...
### Expected Behavior
I guess blur images gotta be the same.
### Link to reproduction
/
### To Reproduce
Use an image with image/future
Pass blurDataURL
See result with next dev
See result with next start | https://github.com/vercel/next.js/issues/39035 | https://github.com/vercel/next.js/pull/39190 | d2462576024f737ff32b659949fac47a7162710f | 970469f35961cb1352817818773a5556b48c16f9 | "2022-07-26T19:03:45Z" | javascript | "2022-08-11T00:09:42Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 39,006 | ["packages/next/shared/lib/router/router.ts", "test/e2e/middleware-rewrites/app/middleware.js", "test/e2e/middleware-rewrites/app/pages/404.js", "test/e2e/middleware-rewrites/test/index.test.ts"] | SSR + custom 404 page + middleware on 12.2 causes client-side navigations between deployments to display a 404 | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 21.2.0: Sun Nov 28 20:28:41 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T6000
Binaries:
Node: 16.15.0
npm: 8.5.5
Yarn: 1.22.19
pnpm: 7.0.0-rc.7
Relevant packages:
next: 12.2.4-canary.0
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
### What browser are you using? (if relevant)
Brave 1.41.100 Chromium: 103.0.5060.134 (Official Build) (arm64)
### How are you deploying your application? (if relevant)
Vercel
### Describe the Bug
Nextjs router is unable to properly perform client side navigations after a fresh deployment is published in projects that use SSR, custom 404 page, and with any middleware function. If a user loads a page, then a deployment happens, then the user attempts to navigate, they will be presented with the custom 404 page. Refreshing the page will correctly display the server rendered page they attempted to navigate to.
### Expected Behavior
As in [email protected], the router should perform a hard navigation to the target page with the latest deployment.
### Link to reproduction
https://github.com/bryanrsmith/simple-app
### To Reproduce
https://github.com/bryanrsmith/simple-app is a simple app with two pages that use SSR. Also note that a custom 404 page is defined, and the project has a middleware function that does nothing (immediately returns `NextResponse.next()`).
1. Deploy this project to vercel.
2. Load the site in a new browser tab, but do not click any links.
3. Redeploy the project (either a trivial code change, or use the Vercel dashboard to redeploy).
4. Return to the original browser tab without refreshing it.
5. Click the link to the other page, and then click the link back to the home page.
Expected: The navigations should succeed.
Actual: The custom 404 page is shown.
While viewing the errant 404 page, a hard refresh will successfully display the server rendered page.
| https://github.com/vercel/next.js/issues/39006 | https://github.com/vercel/next.js/pull/39148 | a8186065b8eb30ef73d82075dbeb2a6fd94c2eaa | e3efc030cdb2336f2c45739b7e7fcfc783f82586 | "2022-07-25T20:56:25Z" | javascript | "2022-07-28T20:48:26Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 38,967 | ["packages/next/server/config-schema.ts"] | compiler.relay must NOT have additional properties | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:37 PDT 2022; root:xnu-8020.121.3~4/RELEASE_ARM64_T6000
Binaries:
Node: 16.15.0
npm: 8.5.5
Yarn: 3.2.0
pnpm: N/A
Relevant packages:
next: 12.2.4-canary.0
eslint-config-next: 12.1.6
react: 0.0.0-experimental-c1f5884ff-20220705
react-dom: 0.0.0-experimental-c1f5884ff-20220705
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
This bug happens in the last canary, a week ago it was ok. The compiler works, that means that the values passed are properly arriving to the compiler, but we have a bunch of disturbing warning messages.
This config for a relay project warns:
```js
module.exports = {
// ..
compiler: {
relay: {
// THIS 3 ARE OK
src: 'scenes',
schema: 'schema/server.graphql',
language: 'flow',
// ANYTHING ELSE WARNS
customScalars: {
DateTime: 'string',
Upload: 'File',
},
}
}
```
```text
warn - Invalid next.config.js options detected:
[
{
"instancePath": "/compiler/relay",
"schemaPath": "#/properties/compiler/properties/relay/additionalProperties",
"keyword": "additionalProperties",
"params": {
"additionalProperty": "schema"
},
"message": "must NOT have additional properties"
},
{
"instancePath": "/compiler/relay",
"schemaPath": "#/properties/compiler/properties/relay/additionalProperties",
"keyword": "additionalProperties",
"params": {
"additionalProperty": "schemaExtensions"
},
"message": "must NOT have additional properties"
},
{
"instancePath": "/compiler/relay",
"schemaPath": "#/properties/compiler/properties/relay/additionalProperties",
"keyword": "additionalProperties",
"params": {
"additionalProperty": "customScalars"
},
"message": "must NOT have additional properties"
},
{
"instancePath": "/compiler/relay",
"schemaPath": "#/properties/compiler/properties/relay/additionalProperties",
"keyword": "additionalProperties",
"params": {
"additionalProperty": "noFutureProofEnums"
},
"message": "must NOT have additional properties"
}
]
```
### Expected Behavior
Must not be warnings for needed parameters in `compiler.relay`.
### Link to reproduction
https://stackblitz.com/edit/vercel-next-js-gjket8?file=next.config.js
### To Reproduce
Start on dev and see the warnings in the console. | https://github.com/vercel/next.js/issues/38967 | https://github.com/vercel/next.js/pull/39010 | 5bd155e22032185c1b3f821793db7292d1ff68cd | 0de6269c9d21809dc6094ed44e88bfaf14ee8dc0 | "2022-07-24T14:19:42Z" | javascript | "2022-07-26T13:07:39Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 38,918 | ["packages/next/shared/lib/router/router.ts", "test/e2e/middleware-rewrites/app/pages/index.js", "test/e2e/middleware-rewrites/app/pages/ssg.js", "test/e2e/middleware-rewrites/test/index.test.ts", "test/integration/dynamic-routing/test/index.test.js", "test/integration/middleware-prefetch/tests/index.test.js"] | Middleware affecting getInitialProps after 12.2.0 | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #44~20.04.1-Ubuntu SMP Fri Jun 24 13:27:29 UTC 2022
Binaries:
Node: 14.17.5
npm: 6.14.14
Yarn: 1.22.17
pnpm: 6.32.1
Relevant packages:
next: 12.2.3-canary.17
eslint-config-next: 12.2.3
react: 18.2.0
react-dom: 18.2.0
### What browser are you using? (if relevant)
Brave
### How are you deploying your application? (if relevant)
self hosted (locally)
### Describe the Bug
hello,
I have an app that has a _app.js with a `getInitialProps`, but also some other pages that still have `getInitialProps` implemented.
After updating to Next.js 12.2 we are noticing that the presence of the middleware file makes it so that these `getInitialProps` run both on client and server always (first the sever then the client), removing the middleware file restores the old behaviour where the `getInitialProps` runs only on the client when doing a client transition and on the server when doing a server reload
this feels a bit at odds with the documentation on `getInitialProps` https://nextjs.org/docs/api-reference/data-fetching/get-initial-props "For the initial page load, `getInitialProps` will run on the server only. `getInitialProps` will then run on the client when navigating to a different route via the next/link component or by using next/router" -> The page in question does not implement `getServersideProps` (but I do have a `getInitialProps` in `_app.js` as described above)
My question is : Is this intentional behaviour? that adding a middleware affects how the `getInitialProps` function behaves? And was this meant to be introduced in 12.2? I understand that middleware was not stable before and so there are changes to it that were to be expected but since this behaviour is not documented I was wondering if this is indeed intentional or not.
Here are 2 videos of a bare bones next app demonstrating the issue :
#### Without any middleware
Without any middleware the behaviour we can see is that `getInitialProps` works as documented, when doing a server load it runs on th server and when doing a client transition it runs on the client
https://user-images.githubusercontent.com/2866604/180443142-d664c9eb-490a-4319-b185-02ffefff1ebe.mp4
#### With middleware
With middlware we can see that for the same app the behaviour changes, and it now runs always on server and client even when doing client transitions (where previously it would only run on the client)
https://user-images.githubusercontent.com/2866604/180443276-b6176885-0fab-43e5-95a0-35b8e413346e.mp4
Here is the repo reproducing the problem
https://github.com/joaogarin/middleware-gip
Thank you!
### Expected Behavior
I would expect the `getInitialProps`to run as documented : If doing a client transition it runs in the client otherwise if doing a full load it runs on the server, but not both.
### Link to reproduction
https://github.com/joaogarin/middleware-gip
### To Reproduce
`yarn install && yarn dev` - see the logs n the console. even if doing a client side transition the `getInitialProps` is being called twice both on the server and client
This also happens in a build application (with yarn build) | https://github.com/vercel/next.js/issues/38918 | https://github.com/vercel/next.js/pull/39920 | 6a65dc5d3deebcabde380f103e95758727122a92 | f7df3fc1587089f25de8f9cba41ce436059e0bbe | "2022-07-22T13:00:56Z" | javascript | "2022-08-26T21:24:10Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 38,909 | ["packages/next/server/config-schema.ts", "packages/next/server/config-shared.ts"] | next.config.js ajv verification: analyticsId - must NOT have additional properties | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
```
Operating System:
Platform: win32
Arch: x64
Version: Windows 10 Pro
Binaries:
Node: 18.4.0
npm: N/A
Yarn: N/A
pnpm: N/A
Relevant packages:
next: 12.2.3
eslint-config-next: 12.2.3
react: 18.2.0
react-dom: 18.2.0
```
### What browser are you using? (if relevant)
chrome
### How are you deploying your application? (if relevant)
next start
### Describe the Bug
seems next 12.2.3 do now validates next.config.js with ajv (https://github.com/vercel/next.js/pull/38498).
As I'm using vercel analytics on my non-vercel deployments, I need to hand in the analyticsId property to next.config.js.
```
/**
* @type {import('next').NextConfig}
**/
const config = {
trailingSlash: false, // disable trailing slashes.
poweredByHeader: false, // disable powered by header.
reactStrictMode: true, // set strict mode for react.
swcMinify: true, // minify using swc/rust.
compress: false, // let nginx handle compression.
analyticsId: "MY_ANALYTICS_ID", // vercel analytics id.
```
and at the very startup next 12.2.3 now warns about the analyticsId property:
```
warn - Invalid next.config.js options detected:
[
{
"instancePath": "",
"schemaPath": "#/additionalProperties",
"keyword": "additionalProperties",
"params": {
"additionalProperty": "analyticsId"
},
"message": "must NOT have additional properties"
}
]
See more info here: https://nextjs.org/docs/messages/invalid-next-config
```
### Expected Behavior
allow analyticsId property without a warning.
### Link to reproduction
.
### To Reproduce
add analyticsId from vercel to next.config.js. | https://github.com/vercel/next.js/issues/38909 | https://github.com/vercel/next.js/pull/38911 | 0f99768f9811fdf027a083471bd2a435f6207f4a | 02f46f022ddf505ddb8d41f3669e8ba179ced8a6 | "2022-07-22T10:56:12Z" | javascript | "2022-07-22T13:50:24Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 38,864 | ["docs/api-reference/next/future/image.md", "packages/next/client/future/image.tsx", "test/integration/image-future/default/pages/on-loading-complete.js"] | Image component should forward ref | ### Describe the feature you'd like to request
I would like to be able to use `useRef` with nextjs/Image. I want to use the Image element to show remote images in a feed and then allow users to click to copy the image with some text over it. In order to do that I need to draw the image to a canvas, and in order to do that I need to have a reference to the htmlImageElement.
### Describe the solution you'd like
Ideally nextjs/Image should [forward the ref](https://reactjs.org/docs/forwarding-refs.html) on Image to the underlying <img>. It also wouldn't be unworkable if I could pass a function that would be called with an `htmlImageElement` when something updates. The important thing is that there's some way to access the underlying element.
### Describe alternatives you've considered
As stands we just use an HTML `<picture><img>` but this sort of sucks because the images resize in weird ways. Additionally, this request is essentially the same as #18398, particularly [these](https://github.com/vercel/next.js/issues/18398#issuecomment-1001009886) [comments](https://github.com/vercel/next.js/issues/18398#issuecomment-873775547). | https://github.com/vercel/next.js/issues/38864 | https://github.com/vercel/next.js/pull/40326 | 5793301c609036b7845a909e8420e8c0e0778624 | 75e5616ce4d20db7f8c58839b806527a03a6d119 | "2022-07-21T11:31:34Z" | javascript | "2022-09-08T15:37:41Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 38,794 | ["packages/next/shared/lib/router/router.ts", "test/e2e/middleware-rewrites/app/next.config.js", "test/e2e/middleware-rewrites/test/index.test.ts"] | Static page with rewrite not getting passed page props for second rerender client side | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:22 PDT 2022; root:xnu-8020.121.3~4/RELEASE_X86_64
Binaries:
Node: 14.19.1
npm: 8.10.0
Yarn: 1.22.19
pnpm: 6.32.11
Relevant packages:
next: 12.2.3-canary.14
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
### What browser are you using? (if relevant)
Chrome 103.0.5060.114
### How are you deploying your application? (if relevant)
vercel
### Describe the Bug
When using SSG page and an `afterFiles` rewrite on vercel infrastructure only the page initially is passed the page props from getStaticProps, but a client side rerender no longer is passed the page props.
### Expected Behavior
The page props should be passed on every page re-render
### Link to reproduction
https://github.com/wweaver/next-playground
### To Reproduce
* https://next-playground-git-main-wweaver.vercel.app/river/
* https://github.com/wweaver/next-playground
1. Create an SSG page with getStaticProps that passes page props
2. Add an afterFiles rewrite that will reroute to the SSG page | https://github.com/vercel/next.js/issues/38794 | https://github.com/vercel/next.js/pull/39153 | c567d7d2daa9e7f24f966ecb27709032d967eaeb | a154c15799345020efcf234e76dd5d9563bb48ff | "2022-07-19T13:54:18Z" | javascript | "2022-07-29T01:23:18Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 38,783 | ["packages/next/shared/lib/router/utils/parse-path.ts", "test/e2e/basepath.test.ts", "test/integration/production/test/index.test.js", "test/lib/next-test-utils.js"] | 12.2 breaks URL hashes with a "?" | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:24 PDT 2021; root:xnu-8019.41.5~1/RELEASE_ARM64_T8101
Binaries:
Node: 16.15.0
npm: 8.12.0
Yarn: 1.22.17
pnpm: 6.24.4
Relevant packages:
next: 12.2.3-canary.14
eslint-config-next: N/A
react: 18.1.0
react-dom: 18.1.0
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
Vercel
### Describe the Bug
Visit [https://vercel.com/blog#asdf?](https://vercel.com/blog#asdf?)
Notice the URL changes to [https://vercel.com/blog#asdf#asdf#asdf#asdf#asdf#asdf#asdf#asdf#asdf?](https://vercel.com/blog#asdf#asdf#asdf#asdf#asdf#asdf#asdf#asdf#asdf?)
Click refresh and it does it again
### Expected Behavior
The hash part of the URL should not change on page load
### Link to reproduction
[https://vercel.com/blog#asdf?](https://vercel.com/blog#asdf?)
### To Reproduce
Unfortunately, we're not sure.
Our closed-source repo exhibits the behavior on canary, and we noticed vercel.com and nextjs.org exhibit the behavior as well.
However, we have not been able to recreate with a fresh canary repo, and we're not sure exactly what triggers the behavior on our closed-source repo.
We have reverted to 12.1.6 where the behavior is not present. | https://github.com/vercel/next.js/issues/38783 | https://github.com/vercel/next.js/pull/38852 | 14463ddd10eb24c308c96df12874fb9862abefe4 | 366a04b7acd415f794d8a43b4d8bc9a2439113d5 | "2022-07-19T01:54:22Z" | javascript | "2022-07-21T19:16:38Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 38,749 | ["examples/cms-wordpress/lib/api.js"] | Docs: accurate .env.local wordpress_uri in the docs | ### What is the improvement or update you wish to see?
In the docs of cms-wordpress, change the required wordpress url from https://myapp.wpengine.com/graphql to https://myapp.wpengine.com
### Is there any context that might help us understand?
When bootstrapping the WordPress cms example, the docs say that the WordPress URL should be website should be https://myapp.wpengine.com/graphql, when it should actually be https://myapp.wpengine.com because when making the fetch request, graphql is added.
### Does the docs page already exist? Please link to it.
https://github.com/vercel/next.js/tree/canary/examples/cms-wordpress | https://github.com/vercel/next.js/issues/38749 | https://github.com/vercel/next.js/pull/38764 | f004868706b1aafc8085ade11fee5a08bc920a12 | 4e3716d1007b68c3c9473f43bce3ac11698ccd70 | "2022-07-18T06:20:39Z" | javascript | "2022-07-18T18:11:33Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 38,743 | ["errors/invalid-page-config.md", "packages/next/build/analysis/extract-const-value.ts", "packages/next/build/analysis/get-page-static-info.ts", "test/e2e/switchable-runtime/index.test.ts", "test/e2e/switchable-runtime/pages/api/edge.js", "test/production/exported-runtimes-value-validation/index.test.ts", "test/production/exported-runtimes-value-validation/invalid-runtime/app/pages/index.js", "test/production/exported-runtimes-value-validation/unsupported-syntax/app/pages/index.js"] | Edge Functions silently falling back to Nodejs Runtime | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
```bash
PS C:\Users\drake\GitHub\@saeris\edge-fail> yarn next info
Operating System:
Platform: win32
Arch: x64
Version: Windows 10 Pro
Binaries:
Node: 18.4.0
npm: N/A
Yarn: N/A
pnpm: 7.4.0
Relevant packages:
next: 12.2.3-canary.10
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
warn - Latest canary version not detected, detected: "12.2.3-canary.10", newest: "12.2.3-canary.9".
Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue.
Read more - https://nextjs.org/docs/messages/opening-an-issue
```
### What browser are you using? (if relevant)
N/A
### How are you deploying your application? (if relevant)
Vercel
### Describe the Bug
I first noticed this behavior when upgrading a Nextjs 12.1 project to 12.2, having followed the migration guide to convert my Nodejs API routes to the new Edge function runtime. Quickly I found out that my routes weren't behaving as expected, as I was getting an error from the following line:
```typescript
const { searchParams, origin } = new URL(req.url);
```
Here I am following the recommendation from the middleware migration guide [here](https://nextjs.org/docs/messages/middleware-upgrade-guide#after) (Please note, it has been [mentioned](https://nextjs.org/docs/api-reference/edge-runtime) in the docs that the Edge Runtime and Middleware share the same function signature and runtime API). This pattern is also mentioned in the official [Edge Functions docs](https://nextjs.org/docs/api-routes/edge-api-routes#query-parameters). This results in a runtime error because `req.url` is not a complete url, it's only the pathname.
```bash
error - TypeError [ERR_INVALID_URL]: Invalid URL
at new NodeError (node:internal/errors:388:5)
at URL.onParseError (node:internal/url:564:9)
at new URL (node:internal/url:644:5)
at handler (webpack-internal:///(api)/./src/pages/api/check.ts:27:40)
at Object.apiResolver (C:\Users\drake\GitHub\@saeris\worbik\node_modules\next\dist\server\api-utils\node.js:179:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async DevServer.runApi (C:\Users\drake\GitHub\@saeris\worbik\node_modules\next\dist\server\next-server.js:381:9)
at async Object.fn (C:\Users\drake\GitHub\@saeris\worbik\node_modules\next\dist\server\base-server.js:497:37)
at async Router.execute (C:\Users\drake\GitHub\@saeris\worbik\node_modules\next\dist\server\router.js:213:36)
at async DevServer.run (C:\Users\drake\GitHub\@saeris\worbik\node_modules\next\dist\server\base-server.js:616:29) {
input: '/api/check?guess=5inrvareifaodavmlLbaolklbA&challenge=5inrvaeifarodavmlLbaolklbA199',
code: 'ERR_INVALID_URL',
page: '/api/check'
}
```
This lead me to investigate further and so I put together a minimal edge route to log out the `NextRequest` and `NextFetchEvent` arguments to see what I was getting back from them:
```typescript
import type { NextMiddleware } from "next/server";
export const config = {
runtime: `experimental-edge`,
};
const handler: NextMiddleware = (req, event) => {
// req is a NextRequest as the types indicate
// event should be a NextFetchEvent, instead it's a ServerResponse
// eslint-disable-next-line no-console
console.log({ req, event, url: req.url });
return new Response();
};
export default handler;
```
In the minimal reproduction I've provided, running `yarn dev` and then visiting `localhost:3000/api/edge` will lead to the following to be logged in your terminal:
```bash
PS C:\Users\drake\GitHub\@saeris\edge-fail> yarn dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
warn - You have enabled experimental feature (images) in next.config.js.
warn - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.
event - compiled client and server successfully in 296 ms (153 modules)
wait - compiling /api/edge...
event - compiled successfully in 20 ms (31 modules)
{
req: IncomingMessage {
_readableState: ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: [],
flowing: true,
ended: true,
endEmitted: true,
reading: false,
constructed: true,
sync: true,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
errorEmitted: false,
emitClose: true,
autoDestroy: true,
destroyed: true,
errored: null,
closed: true,
closeEmitted: true,
defaultEncoding: 'utf8',
awaitDrainWriters: null,
multiAwaitDrain: false,
readingMore: true,
dataEmitted: false,
decoder: null,
encoding: null,
[Symbol(kPaused)]: false
},
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
socket: Socket {
connecting: false,
_hadError: false,
_parent: null,
_host: null,
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 8,
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: true,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: [Server],
_server: [Server],
parser: [HTTPParser],
on: [Function: socketListenerWrap],
addListener: [Function: socketListenerWrap],
prependListener: [Function: socketListenerWrap],
setEncoding: [Function: socketSetEncoding],
_paused: false,
_httpMessage: [ServerResponse],
[Symbol(async_id_symbol)]: 2744,
[Symbol(kHandle)]: [TCP],
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kSetNoDelay)]: false,
[Symbol(kSetKeepAlive)]: false,
[Symbol(kSetKeepAliveInitialDelay)]: 0,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0
},
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
rawHeaders: [
'Host',
'localhost:3000',
'Connection',
'keep-alive',
'Cache-Control',
'max-age=0',
'sec-ch-ua',
'" Not A;Brand";v="99", "Chromium";v="102", "Microsoft Edge";v="102"',
'sec-ch-ua-mobile',
'?0',
'sec-ch-ua-platform',
'"Windows"',
'DNT',
'1',
'Upgrade-Insecure-Requests',
'1',
'User-Agent',
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.124 Safari/537.36 Edg/102.0.1245.44',
'Accept',
'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
'Sec-Fetch-Site',
'none',
'Sec-Fetch-Mode',
'navigate',
'Sec-Fetch-User',
'?1',
'Sec-Fetch-Dest',
'document',
'Accept-Encoding',
'gzip, deflate, br',
'Accept-Language',
'en-US,en;q=0.9'
],
rawTrailers: [],
aborted: false,
upgrade: false,
url: '/api/edge',
method: 'GET',
statusCode: null,
statusMessage: null,
client: Socket {
connecting: false,
_hadError: false,
_parent: null,
_host: null,
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 8,
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: true,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: [Server],
_server: [Server],
parser: [HTTPParser],
on: [Function: socketListenerWrap],
addListener: [Function: socketListenerWrap],
prependListener: [Function: socketListenerWrap],
setEncoding: [Function: socketSetEncoding],
_paused: false,
_httpMessage: [ServerResponse],
[Symbol(async_id_symbol)]: 2744,
[Symbol(kHandle)]: [TCP],
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kSetNoDelay)]: false,
[Symbol(kSetKeepAlive)]: false,
[Symbol(kSetKeepAliveInitialDelay)]: 0,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0
},
_consuming: false,
_dumped: false,
cookies: [Getter/Setter],
query: {},
previewData: [Getter/Setter],
preview: [Getter/Setter],
body: '',
[Symbol(kCapture)]: false,
[Symbol(kHeaders)]: {
host: 'localhost:3000',
connection: 'keep-alive',
'cache-control': 'max-age=0',
'sec-ch-ua': '" Not A;Brand";v="99", "Chromium";v="102", "Microsoft Edge";v="102"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
dnt: '1',
'upgrade-insecure-requests': '1',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.124 Safari/537.36 Edg/102.0.1245.44',
accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
'sec-fetch-site': 'none',
'sec-fetch-mode': 'navigate',
'sec-fetch-user': '?1',
'sec-fetch-dest': 'document',
'accept-encoding': 'gzip, deflate, br',
'accept-language': 'en-US,en;q=0.9'
},
[Symbol(kHeadersCount)]: 32,
[Symbol(kTrailers)]: null,
[Symbol(kTrailersCount)]: 0,
[Symbol(NextRequestMeta)]: {
__NEXT_INIT_URL: 'http://localhost:3000/api/edge',
__NEXT_INIT_QUERY: {},
_protocol: 'http',
__nextHadTrailingSlash: false,
__nextIsLocaleDomain: false
}
},
event: <ref *1> ServerResponse {
_events: [Object: null prototype] {
finish: [Function: bound resOnFinish],
pipe: [Function]
},
_eventsCount: 2,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: false,
_last: false,
chunkedEncoding: false,
shouldKeepAlive: true,
maxRequestsOnConnectionReached: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: true,
sendDate: true,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: false,
_headerSent: false,
_closed: false,
socket: Socket {
connecting: false,
_hadError: false,
_parent: null,
_host: null,
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 8,
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: true,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: [Server],
_server: [Server],
parser: [HTTPParser],
on: [Function: socketListenerWrap],
addListener: [Function: socketListenerWrap],
prependListener: [Function: socketListenerWrap],
setEncoding: [Function: socketSetEncoding],
_paused: false,
_httpMessage: [Circular *1],
[Symbol(async_id_symbol)]: 2744,
[Symbol(kHandle)]: [TCP],
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kSetNoDelay)]: false,
[Symbol(kSetKeepAlive)]: false,
[Symbol(kSetKeepAliveInitialDelay)]: 0,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0
},
_header: null,
_keepAliveTimeout: 5000,
_onPendingData: [Function: bound updateOutgoingData],
req: IncomingMessage {
_readableState: [ReadableState],
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
socket: [Socket],
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
rawHeaders: [Array],
rawTrailers: [],
aborted: false,
upgrade: false,
url: '/api/edge',
method: 'GET',
statusCode: null,
statusMessage: null,
client: [Socket],
_consuming: false,
_dumped: false,
cookies: [Getter/Setter],
query: {},
previewData: [Getter/Setter],
preview: [Getter/Setter],
body: '',
[Symbol(kCapture)]: false,
[Symbol(kHeaders)]: [Object],
[Symbol(kHeadersCount)]: 32,
[Symbol(kTrailers)]: null,
[Symbol(kTrailersCount)]: 0,
[Symbol(NextRequestMeta)]: [Object]
},
_sent100: false,
_expect_continue: false,
statusCode: 200,
flush: [Function: flush],
write: [Function (anonymous)],
end: [Function (anonymous)],
on: [Function: on],
writeHead: [Function: writeHead],
status: [Function (anonymous)],
send: [Function (anonymous)],
json: [Function (anonymous)],
redirect: [Function (anonymous)],
setPreviewData: [Function (anonymous)],
clearPreviewData: [Function (anonymous)],
revalidate: [Function (anonymous)],
unstable_revalidate: [Function (anonymous)],
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: null,
[Symbol(kUniqueHeaders)]: null
},
url: '/api/edge'
}
```
As you can see, clearly we're not getting the expected data types here. The above matches what you would expect from the standard Nodejs runtime, where `NextRequest` extends `IncomingMessage` and `NextResponse` extends `ServerResponse`. Additionally as you can see, `req.url` was logged as `/api/edge`, which explains why the code I wrote earlier to extract request parameters resulted in a runtime error.
From here the next steps I tried were to run `yarn why next` to determine if I hadn't actually upgraded to 12.2. Nothing appeared to be wrong there. So to be safe, I nuked my `node_modules`, yarn lockfile, etc and reinstalled. Same issue. Another developer suggested I try using another 12.2 feature to verify that I was indeed running it, so I enabled `next/future/image` in my `next.config.js`, which you can see from the console output above I'm properly getting warned about on startup.
It was from this point I started putting together a minimal, because as far as I can tell I'm doing all I need to in order to opt into using the Edge runtime. With that together, I was able to reproduce this failure on two additional machines (Windows 10 and macOS Monterey) as well as inside of GitHub Codespaces and asking another engineer to confirm.
### Expected Behavior
I just want to be able to use the Edge runtime for my API routes and have a clear understanding of why the documented configuration instructions aren't working. 😭
### Link to reproduction
https://github.com/Saeris/edge-fail
### To Reproduce
> Please refer to the linked repository README for additional details
## Steps to Reproduce
- Install deps: `yarn`
- Check Nextjs version: `yarn why next`
- Start dev server: `yarn dev`
- Review console output, should have warning for experimental Nextjs feature (images), verifying the server is ^v12.2.0. Missing is a warning about experimental edge runtime.
- Visit api route: http://localhost:3000/api/edge
- Review console output, should be following shape:
```bash
{
req: IncomingMessage {
...
},
event: ServerResponse {
...
},
url: '/api/edge'
}
``` | https://github.com/vercel/next.js/issues/38743 | https://github.com/vercel/next.js/pull/38750 | 366a04b7acd415f794d8a43b4d8bc9a2439113d5 | 02c78a5c15c8e9fac3fceb8a20b7182f37e5398e | "2022-07-17T22:15:15Z" | javascript | "2022-07-21T19:56:52Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 38,742 | ["packages/next/build/utils.ts"] | Rewrites with destination `/index/` do not work in standalone mode | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:22 PDT 2022; root:xnu-8020.121.3~4/RELEASE_X86_64
Binaries:
Node: 16.14.0
npm: 8.3.1
Yarn: N/A
pnpm: N/A
Relevant packages:
next: 12.2.3-canary.10
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
In `standalone` output mode rewrites with a destination of `/index/` do not work. With other destination values like `/test/` or running the app in non-standalone mode (`npm run dev` or `npm run start`) the behavior does not occur.
### Expected Behavior
The query params on the wildcard page template `[[.../slug]].js` should contain a param `slug` with the value `index` for the following urls:
- `/`
- `/test-middleware/`.
### Link to reproduction
https://github.com/chrilis/next-standalone-rewrite
### To Reproduce
- Run `npm run build && cp -r public .next/standalone && cp -r .next/static .next/standalone/.next && node .next/standalone/server.js`
- Visit [http://localhost:3000/](http://localhost:3000/): The query should contain a param `slug` with the value `index`, but it does not.
- Visit [http://localhost:3000/test-middleware/](http://localhost:3000/test-middleware/): The query should contain a param `slug` with the value `index`, but it does not. | https://github.com/vercel/next.js/issues/38742 | https://github.com/vercel/next.js/pull/38831 | 4e6b4ef13e47cd5a645d8a266b278f94a86928b6 | 672bdaee403c5f6ab3c7181c683849dfcf94942f | "2022-07-17T22:14:29Z" | javascript | "2022-07-20T19:52:01Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 38,621 | ["packages/next/client/future/image.tsx", "test/integration/image-future/default/test/index.test.ts", "test/integration/image-future/noscript/next.config.js", "test/integration/image-future/noscript/pages/index.js", "test/integration/image-future/noscript/test/index.test.ts"] | `next/future/image` with a blurred placeholder shows double images when JS is disabled | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
```
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:22 PDT 2022; root:xnu-8020.121.3~4/RELEASE_X86_64
Binaries:
Node: 18.5.0
npm: 8.13.2
Yarn: 1.22.19
pnpm: N/A
Relevant packages:
next: 12.2.3-canary.5
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
```
### What browser are you using? (if relevant)
Chrome 103.0.5060.114, Chrome Canary 105.0.5177.0, Firefox 102.0.1
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
There's something going on with the `<noscript>` behavior of `next/future/image` that I can't quite figure out...
The original `next/image` with `placeholder="blur"` simply falls back to a normal image tag when JavaScript has been disabled, but the future version either:
1. Shows a blurry image on the left, and the real image on the right in development, or
2. Shows two identical images in production.
### Expected Behavior
One image displayed per one `<Image />` component, whether or not JavaScript is enabled in the browser.
### Link to reproduction
https://github.com/jakejarvis/next-future-image-bug
### To Reproduce
I've tested this in both Chrome and Firefox. To reproduce this specific behavior, JavaScript must be disabled from the dev tools panel followed by a refresh.
- [Chrome instructions](https://developer.chrome.com/docs/devtools/javascript/disable/)
- [Firefox instructions](https://flailingmonkey.com/disable-javascript-option-now-available-in-firefox-developer-tools)
The reproduction is deployed to Vercel at https://next-future-image-bug.vercel.app/. This shows the two identical images next to each other.
Or, clone [the reproduction repo](https://github.com/jakejarvis/next-future-image-bug) locally (`git clone https://github.com/jakejarvis/next-future-image-bug.git` and `next dev`) to see the case where there is one blurred image and one clear image side-by-side.
<img width="1186" alt="Screen Shot 2022-07-13 at 3 10 20 PM" src="https://user-images.githubusercontent.com/1703673/178813991-059b992e-3f06-402a-869a-716f0b2578f5.png">
Both sections use the same statically imported JPG with `placeholder="blur"` being the only other prop set, i.e.:
```jsx
import FutureImage from "next/future/image";
import Image from "next/image";
import pandaJpg from "../public/panda.jpg";
// ...
<FutureImage src={pandaJpg} placeholder="blur" />
<Image src={pandaJpg} placeholder="blur" />
``` | https://github.com/vercel/next.js/issues/38621 | https://github.com/vercel/next.js/pull/40075 | c3ceeb03abb1b262032bd96457e224497d3bbcef | e735c514693bcc17a3b97eb08f2378866597e45e | "2022-07-13T19:34:31Z" | javascript | "2022-08-30T03:59:15Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 38,613 | ["examples/with-service-worker/next-env.d.ts", "examples/with-service-worker/package.json", "examples/with-service-worker/pages/_app.js", "examples/with-service-worker/pages/index.js", "examples/with-service-worker/pages/index.tsx", "examples/with-service-worker/tsconfig.json"] | Service worker example not working with window load event | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:22 PDT 2022; root:xnu-8020.121.3~4/RELEASE_X86_64
Binaries:
Node: 16.15.0
npm: 8.5.5
Yarn: 3.2.0
pnpm: 6.11.0
Relevant packages:
next: 12.2.2
eslint-config-next: N/A
react: 17.0.2
react-dom: 17.0.2
### Which example does this report relate to?
with-service-worker
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
`with-service-worker` example not working and it's not registering the worker. However if register function moved outside of window `load` event, then it works fine.
### Expected Behavior
Registering service via this should work:
```js
useEffect(() => {
if ('serviceWorker' in navigator) {
window.addEventListener('load', function () {
// ... service worker registration code here.
});
}
}, [])
```
while removing `window.addEventListener` part, it's working.
### To Reproduce
1. Run the service worker example and open browser.
2. Go to application tab, you'll not see any registration of service worker. | https://github.com/vercel/next.js/issues/38613 | https://github.com/vercel/next.js/pull/38670 | de7aa2d6e486c40b8be95a1327639cbed75a8782 | bc9a4da4dbdd29bcb1e37fee3ccf449f65c49dac | "2022-07-13T17:21:31Z" | javascript | "2022-07-18T20:01:49Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 38,595 | ["docs/routing/shallow-routing.md"] | Rewrite in middleware causes shallow routing to break. | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:29 PDT 2022; root:xnu-8020.121.3~4/RELEASE_ARM64_T8101
Binaries:
Node: 14.19.1
npm: 6.14.16
Yarn: 1.22.18
pnpm: 7.5.0
Relevant packages:
next: 12.2.4-canary2
eslint-config-next: N/A
react: 17.0.2
react-dom: 17.0.2
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
With version v12.2 of Next.js shallow routing stopped working as expected.
We have a middleware that rewrites the route '/' to '/front' when a JWT with the desired payload is present in the request.
(See routing state directly after page load in the 1st attached screenshot)
After the page has loaded we do a shallow push to '/suche', which is not equal to '/' and therefor the current page should be unloaded and '/suche' should be loaded. However instead of the expected behaviour the asPath is set to '/suche' but the page is not unloaded. (See 3rd attached screenshot to see the router state after we pushed '/suche' to the router)
If however we reload the page, and no middleware rewriting occurs (since we are not on '/' or '/front' but on '/suche' instead) the right page is shown.
Router state after page-load:
<img width="386" alt="image" src="https://user-images.githubusercontent.com/30313631/178735194-8cdac2a6-94d2-427e-b533-e4a5e7ec6c82.png">
Code used to push '/suche' to the router:
```js
router.push({ pathname: '/suche', query: newParams }, undefined, {
shallow: true,
})
```
Router state after routing has finished:
<img width="386" alt="image" src="https://user-images.githubusercontent.com/30313631/178735736-640eebe2-30f0-4123-96b3-494bbfda2cbd.png">
### Expected Behavior
Expect shallow routing to work like it did pre v12.2 and as stated in the [docs](https://nextjs.org/docs/routing/shallow-routing).
Meaning: if a shallow route is pushed for a path that is not the current path, the page should be normally routed as described in the [caveats section ](https://nextjs.org/docs/routing/shallow-routing#caveats) of the shallow routing docs.
### Link to reproduction
https://github.com/trm217/nextjs-12.2-shallow-rewrite-issue-reproduction
### To Reproduce
1. Press the toggle auth state button to make the page reload for the authenticated state.
After the reload you will see / has been rewritten to /member.
2. Enter something in the search input and submit.
You will notice that the route has changed, but the shallow route push hasn't actually loaded the '/search' page | https://github.com/vercel/next.js/issues/38595 | https://github.com/vercel/next.js/pull/39154 | d091c818c5a66c7137275e2b0b711bc105898e19 | cf729edc9d1e3b0d36e20087e360663b69160cc7 | "2022-07-13T13:34:13Z" | javascript | "2022-07-29T02:28:34Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 38,556 | ["packages/next/server/api-utils/node.ts", "test/e2e/prerender.test.ts", "test/e2e/prerender/pages/api/enable.js", "test/e2e/prerender/pages/preview.js"] | Public available page shows preview version if `res.revalidate('/some-page')` is called by a user with enabled preview mode | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:01 PDT 2021; root:xnu-8019.41.5~1/RELEASE_ARM64_T6000
Binaries:
Node: 14.19.3
npm: 6.14.17
Yarn: 1.22.19
pnpm: 7.5.0
Relevant packages:
next: 12.2.2
eslint-config-next: 12.2.2
react: 18.2.0
react-dom: 18.2.0
### What browser are you using? (if relevant)
Chrome
### How are you deploying your application? (if relevant)
Vercel
### Describe the Bug
If a user with enabled preview mode is triggering an on-demand ISR from the same browser which has the preview-mode cookies set, the page get's build in preview mode and the preview-mode version of it is made publicly available via the CDN for all visitors
### Expected Behavior
Only show preview mode to visitors which have preview mode enabled and ignore preview mode for requests which have been made via `res.revalidate`
### Link to reproduction
only on vercel, therefore no stackblitz
### To Reproduce
1.) add `const {isPreview} = useRouter(); console.log(isPreview)` to any page of your next.js project
2.) enable the preview mode for the current session via an API route and `res.setPreviewData({});`. The console.log is logging isPreview = true
3.) trigger an ondemand isr with an API route and `res.revalidate('/some-page')`
4.) open `/some-page` in a new private tab. Because we have no cookies the preview mode is disabled. But still the console.log will log isPreview = true because the page revalidation was triggered from an user with active preview mode | https://github.com/vercel/next.js/issues/38556 | https://github.com/vercel/next.js/pull/39313 | 6b49d4744c204d9d572ef2540f092c6195a56bb2 | d315ee1786fddbef728e2c6a26596e79cc916c48 | "2022-07-12T12:53:02Z" | javascript | "2022-08-04T13:23:54Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 38,528 | ["packages/next/shared/lib/router/router.ts", "test/e2e/middleware-base-path/app/pages/dynamic-routes/[routeName].js", "test/e2e/middleware-base-path/app/pages/index.js", "test/e2e/middleware-base-path/test/index.test.ts"] | using middleware with base path | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:22 PDT 2022; root:xnu-8020.121.3~4/RELEASE_X86_64
Binaries:
Node: 16.15.1
npm: 8.11.0
Yarn: 1.22.19
pnpm: N/A
Relevant packages:
next: 12.2.2
eslint-config-next: 12.2.2
react: 17.0.2
react-dom: 17.0.2
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
I added in my next config a basePath. I use the middleware example here https://nextjs.org/docs/advanced-features/i18n-routing for adding the default locale. by doing this all pages with a query are empty. If I remove the middleware everything works.
### Expected Behavior
- redirection works fine
### Link to reproduction
https://github.com/magsout/repro-middleware-nextjs
### To Reproduce
- go to https://github.com/magsout/repro-middleware-nextjs (clone, deploy and run)
- go to http://localhost:3000/admin/en
- click on [Show all environments](http://localhost:3000/admin/en/environments/2) link
- see on devtools console query is empty (no id).
- refresh, see on console query is not empty
if you comment the middleware, no issue at all. | https://github.com/vercel/next.js/issues/38528 | https://github.com/vercel/next.js/pull/40566 | 40b2d1382dcfd3c7dcb4549fc55e3fe8b8fd3675 | 755661144979db84e44caa5bb66b62e350f8a107 | "2022-07-11T19:26:03Z" | javascript | "2022-09-15T22:56:53Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 38,436 | [".github/workflows/build_test_deploy.yml", "packages/next-swc/crates/napi/Cargo.toml"] | Failed to load SWC binary for linux/x64 | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #1 SMP Fri Dec 18 16:34:56 UTC 2020
Binaries:
Node: 16.15.1
npm: 8.11.0
Yarn: N/A
pnpm: 7.4.0
Relevant packages:
next: 12.2.1
eslint-config-next: 12.2.0
react: 17.0.2
react-dom: 16.14.0
### What browser are you using? (if relevant)
Chrome 102
### How are you deploying your application? (if relevant)
next start
### Describe the Bug
my project in gitlab-ci(image: node:lts-buster) buid my app.
run `next build`
i get this error
↓
```info - Skipping validation of types
info - Skipping linting
info - Creating an optimized production build...
info - Downloading WASM swc package...
info - Using experimental wasm build of next-swc
warn - Attempted to load @next/swc-linux-x64-gnu, but it was not installed
warn - Attempted to load @next/swc-linux-x64-gnux32, but it was not installed
warn - Attempted to load @next/swc-linux-x64-musl, but an error occurred: libc.musl-x86_64.so.1: cannot open shared object file: No such file or directory
Failed to compile.```
how can i fix it
### Expected Behavior
null
### Link to reproduction
null
### To Reproduce
null | https://github.com/vercel/next.js/issues/38436 | https://github.com/vercel/next.js/pull/38471 | 06d2380937ad7597a8d7cce2f57d444f733ae79c | d920a171627310d75788e3c22740761ebc0ee02c | "2022-07-08T02:19:24Z" | javascript | "2022-07-09T21:24:38Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 38,431 | ["packages/next/client/future/image.tsx", "test/integration/image-future/base-path/test/static.test.js", "test/integration/image-future/default/test/static.test.js"] | `next/future/image` blurDataUrl throwing error about 'style property should not contain semicolon' | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
```
Operating System:
Platform: linux
Arch: x64
Version: #1 SMP PREEMPT_DYNAMIC Thu, 09 Jun 2022 16:14:10 +0000
Binaries:
Node: 16.15.0
npm: 8.5.5
Yarn: 1.22.19
pnpm: 7.3.0
Relevant packages:
next: 12.2.1-canary.4
eslint-config-next: 12.1.6
react: 18.1.0
react-dom: 18.1.0
```
### What browser are you using? (if relevant)
Brave 1.39.122 Chromium: 102.0.5005.115 (Official Build) (64-bit)
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
When using the new (experimental?) `next/future/image` with `[email protected]`, I'm getting errors in the console that the `style` property shouldn't contain semicolons, with a recommendation to "try this instead". See:

```
Warning: Style property values shouldn't contain a semicolon. Try "backgroundImage:
url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http%3A//www.w3.org/2000/svg' viewBox='0 0
250 125'%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur
stdDeviation='50'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='discrete' tableValues='1
1'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Cimage filter='url(%23b)' x='0' y='0'
height='100%25' width='100%25'
href='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAACCAIAAADwyuo0AAAACXBIWXMAAAsTAAALEwE
AmpwYAAAAI0lEQVQImWMIkQ1b7lH+sWnm/9V9DC4MnAvVbD52R/x/XQUAkkgL+qsVWWQAAAAASUVORK5CYII='/%3E%3C/s
vg%3E")" instead.
```
I've played around with it a bit, and its clearly only appearing when I enable and pass a `blurDataURL`. These data URL's are typical base64 data URI's though, which by definition should contain a semicolon, right?
i.e. `data:image/jpeg;base64,/9j/2wBDAYK.....`
Component in question: https://github.com/ndom91/briefkasten/blob/main/src/components/bookmark-card.jsx#L169-L182
I can't tell for sure, but with the network speed slowed down to `Slow 3G`, it seems that the blur placeholder is not working anymore when this error is thrown. It was previously working with 12.1.X and `next/image` with the same code, however.
### Expected Behavior
Render the blur placeholder while image is loading.
### Link to reproduction
https://briefkasten.vercel.app
### To Reproduce
Login to my sideproject bookmark app linked above, add a bookmark, and reload the page. | https://github.com/vercel/next.js/issues/38431 | https://github.com/vercel/next.js/pull/38454 | 050d13e0c8afbb9d0ec5d0bb5793e2acbe5c8dd4 | 2fa96822e70b80867b64b38af522601d9c0af38b | "2022-07-07T21:49:00Z" | javascript | "2022-07-08T16:24:03Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 38,383 | ["packages/next/client/future/image.tsx"] | next/jest tests error when testing next/future/image even when enabled in config | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #43-Ubuntu SMP Wed Jun 15 12:54:21 UTC 2022
Binaries:
Node: 17.9.0
npm: 8.5.5
Yarn: 1.22.18
pnpm: 7.0.1
Relevant packages:
next: 12.2.0
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
### Which example does this report relate to?
with-jest
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
I've enabled next future image feature but any tests that exercise them fail:
```text
Error: Uncaught [Error: The "next/future/image" component is experimental and may be subject to breaking changes. To enable this experiment, please include `experimental: { images: { allowFutureImage: true } }` in your next.config.js file.]
```
The next image component works fine using `yarn dev` and I even receive this warning when I run my tests before the error:
```text
warn - You have enabled experimental feature (images) in next.config.js.
warn - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.
```
### Expected Behavior
next/future/image is enabled for my test run if enabled in next config and disabled otherwise
### To Reproduce
* Switch next/image in `pages/index.tsx` to next/future/image
* Enable future image in next.config.js using `experimental: { images: { allowFutureImage: true } }`
* Add images.domains array in next.config.js
* run `pnpm test -- --watchAll` | https://github.com/vercel/next.js/issues/38383 | https://github.com/vercel/next.js/pull/38569 | 62f3f87891f71c4ef6d057880d760f318b131191 | 53bc5b3dd326d70da5b8b3d5cd48355b649ffe75 | "2022-07-06T17:09:25Z" | javascript | "2022-07-13T19:45:09Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 38,333 | ["packages/eslint-config-next/index.js"] | TypeScript error on <style> with attributes `global` and `jsx` | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #137-Ubuntu SMP Wed Jun 15 13:33:07 UTC 2022
Binaries:
Node: 16.14.2
npm: 8.7.0
Yarn: 1.22.5
pnpm: N/A
Relevant packages:
next: 12.2.1-canary.2
eslint-config-next: N/A
react: 17.0.2
react-dom: 17.0.2
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
In my project when I try to create a component with global style I get a TypeScript error:
```tsx
// Test.tsx
export function Test() {
return (
<div>
<style global jsx>{``}</style>
{/* ~~~~~~ */}
</div>
)
}
```
```
Type '{ children: string; global: true; jsx: true; }' is not assignable to type 'DetailedHTMLProps<StyleHTMLAttributes<HTMLStyleElement>, HTMLStyleElement>'.
Property 'global' does not exist on type 'DetailedHTMLProps<StyleHTMLAttributes<HTMLStyleElement>, HTMLStyleElement>'.ts(2322)
```
And what seems strange is that `[email protected]` seems to correctly define extension of `react` type with:
```ts
declare module 'react' {
interface StyleHTMLAttributes<T> extends HTMLAttributes<T> {
jsx?: boolean
global?: boolean
}
}
```
But for some reason, this seems not to be used by TypeScript.
### Expected Behavior
No TS error.
### Link to reproduction
https://codesandbox.io/s/musing-mcnulty-i2crqc?file=/components/Test.tsx
### To Reproduce
Just hover the `global` attribute in order to see the TypeScript error. | https://github.com/vercel/next.js/issues/38333 | https://github.com/vercel/next.js/pull/40331 | 712d98d3d7ba3ca9849c964aa611e805291a7f7f | 5793301c609036b7845a909e8420e8c0e0778624 | "2022-07-05T13:53:19Z" | javascript | "2022-09-08T15:21:36Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 38,324 | ["packages/next/build/utils.ts", "test/integration/gsp-build-errors/test/index.test.js"] | Nextjs Build Failed with type: 'WorkerError' | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #43-Ubuntu SMP Wed Jun 15 12:54:21 UTC 2022
Binaries:
Node: 16.15.0
npm: 8.5.5
Yarn: 1.22.18
pnpm: N/A
Relevant packages:
next: 12.2.1-canary.2
eslint-config-next: 12.1.6
react: 18.2.0
react-dom: 18.2.0
### What browser are you using? (if relevant)
Using Brave (But it is irrelevent imo because error in building, dev works fine)
### How are you deploying your application? (if relevant)
not deployed yet
### Describe the Bug
Build fails with the following error messages on the console
```js
yarn run v1.22.18
$ next build
info - Loaded env from /home/rashid/code/projects/blog-web-next/.env
info - Linting and checking validity of types
info - Creating an optimized production build
info - Compiled successfully
info - Collecting page data ..node:internal/child_process/serialization:127
const string = JSONStringify(message) + '\n';
```
{ the below error repeats 7-8 times }
```js
TypeError: Converting circular structure to JSON
--> starting at object with constructor 'ClientRequest'
| property 'socket' -> object with constructor 'TLSSocket'
--- property '_httpMessage' closes the circle
at stringify (<anonymous>)
at writeChannelMessage (node:internal/child_process/serialization:127:20)
at process.target._send (node:internal/child_process:839:17)
at process.target.send (node:internal/child_process:739:19)
at reportError (/home/rashid/code/projects/blog-web-next/node_modules/next/dist/compiled/jest-worker/processChild.js:1:1995)
at reportClientError (/home/rashid/code/projects/blog-web-next/node_modules/next/dist/compiled/jest-worker/processChild.js:1:1671)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
info - Collecting page data .node:internal/child_process/serialization:127
const string = JSONStringify(message) + '\n';
```
{ and then finally this error }
```js
> Build error occurred
Error: Call retries were exceeded
at ChildProcessWorker.initialize (/home/rashid/code/projects/blog-web-next/node_modules/next/dist/compiled/jest-worker/index.js:1:11661)
at ChildProcessWorker._onExit (/home/rashid/code/projects/blog-web-next/node_modules/next/dist/compiled/jest-worker/index.js:1:12599)
at ChildProcess.emit (node:events:527:28)
at ChildProcess.emit (node:domain:475:12)
at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12) {
type: 'WorkerError'
```
### Expected Behavior
Build create Successfully
### Link to reproduction
https://github.com/m3rashid/blog-web-next
### To Reproduce
run the following command
```bash
yarn build
``` | https://github.com/vercel/next.js/issues/38324 | https://github.com/vercel/next.js/pull/39032 | cee2cf379dfe87ff7a9c9fb88fea4acbfe4a20bc | b8460266733716d2d04dfc9657bdfccb197d34aa | "2022-07-05T10:47:50Z" | javascript | "2022-07-26T18:56:29Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 38,304 | ["docs/api-reference/next/router.md"] | router.pathname returns paths without a trailing slash regardless of next.config trailingSlash setting | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
- Platform: darwin
- Arch: arm64
- Version: Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:37 PDT 2022; root:xnu-8020.121.3~4/RELEASE_ARM64_T6000
Binaries:
- Node: 18.0.0
- npm: 8.6.0
- Yarn: N/A
- pnpm: N/A
Relevant packages:
- next: 12.2.1-canary.2
- eslint-config-next: N/A
- react: 18.2.0
- react-dom: 18.2.0
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
`router.pathname` returns paths without the trailing slash (e.g. `/about`) despite `trailingSlash: true` in the `next.config`
### Expected Behavior
`router.pathname` should return paths with the trailing slash as configured e.g. `/about/`
### Link to reproduction
https://github.com/zizzfizzix/next-pathname-trailing-slash-bug
### To Reproduce
1. Install dependencies with `npm install`
2. Start with `npm run dev`
3. Head to the `/about/` page (note: lacks the index page as the root pathname is correct regardless)
4. Compare the output (pathname) with the URL path | https://github.com/vercel/next.js/issues/38304 | https://github.com/vercel/next.js/pull/38835 | 851e9aeba9cf6137da0d9e28815f7096fa9a2f55 | 9416e00bb1c3e09445d619791c220d52d65099d6 | "2022-07-04T18:27:51Z" | javascript | "2022-07-20T15:30:06Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 38,291 | ["examples/with-emotion-swc/shared/styles.tsx", "packages/next-swc/crates/emotion/src/lib.rs", "packages/next-swc/crates/emotion/tests/fixture/css-in-callback/input.tsx", "packages/next-swc/crates/emotion/tests/fixture/css-in-callback/output.ts"] | Next 12.2.0 - Using Emtion with SWC still does not work fully | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
```
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 21.4.0: Fri Mar 18 00:46:32 PDT 2022; root:xnu-8020.101.4~15/RELEASE_ARM64_T6000
Binaries:
Node: 16.14.0
npm: 8.3.1
Yarn: 1.22.17
pnpm: N/A
Relevant packages:
next: 12.2.1-canary.2
eslint-config-next: 12.2.0
react: 18.1.0
react-dom: 18.1.0
```
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
I use `emotion` in our project, before Next 12.2 emotion support in SWC was still experimental and therefore we held off and was still using babel. However, now that it's not experimental we decided to try it out.
However, we get a build error:
```Error: Component selectors can only be used in conjunction with @emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware compiler transform.```
### Expected Behavior
I expected the `swc_emotion` crate in SWC to work correctly
### Link to reproduction
https://codesandbox.io/s/swc-emotion-problem-gnp94o
### To Reproduce
All you need is emotion/react, emotion/styled and to turn it on in next config.
Then you need two styled components, one which is a parent, and the other which will be a child. Then use `Component` selector `${ComponentName}` to style said child. | https://github.com/vercel/next.js/issues/38291 | https://github.com/vercel/next.js/pull/39390 | b30ae643a4faab8931a4b566277a615275a8ab39 | 4264408b164130308e367327eb5e4c314ffb74b3 | "2022-07-04T10:43:23Z" | javascript | "2022-08-08T03:46:11Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 38,204 | ["packages/next/shared/lib/side-effect.tsx"] | next/head breaks when using @preact/compat in 12.2 | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
```
Operating System:
Platform: linux
Arch: x64
Version: #1 SMP Wed Mar 2 00:30:59 UTC 2022
Binaries:
Node: 16.15.0
npm: 8.5.5
Yarn: 1.22.19
pnpm: 7.1.7
Relevant packages:
next: 12.2.1-canary.1
eslint-config-next: N/A
react: N/A
react-dom: N/A
```
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
When using next-plugin-preact, adding a `<Head>` tag to any page from next/head leads to the tags being rendered in the <body> tag with an <undefined></undefined> element due to the bag of head-tags are passed as a Set to the renderer. Hacking in something like following fixes the problem:
*shared/lib/head.js*:
```
function onlyReactElement(list, child) {
[...]
if (child instanceof Set) list.concat(...Array.from(child))
}
```
Removing `next-plugin-preact` also fixes the issue without changing the set to an array.
### Expected Behavior
Usage of Head to work when using next-plugin-preact.
Since there is an official example in the repository, I would expect aliased `@preact/compat` to work.
### Link to reproduction
https://github.com/vattenapa/next-preact-repro
### To Reproduce
start the dev server and visit the website. Console will show warnings about next-head-count missing since it's been moved to the body with an `<undefined></undefined>` tag above it. | https://github.com/vercel/next.js/issues/38204 | https://github.com/vercel/next.js/pull/38252 | 274980f05749830b78d7b3766c6581e510542063 | d6090178fe8d448baf6aaf8bb8aaaad9e8af2b5f | "2022-06-30T14:06:10Z" | javascript | "2022-07-02T01:59:04Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 38,176 | ["packages/next/bin/next.ts", "test/e2e/ssr-react-context/app/context.js", "test/e2e/ssr-react-context/app/pages/_app.js", "test/e2e/ssr-react-context/app/pages/consumer.js", "test/e2e/ssr-react-context/app/pages/index.js", "test/e2e/ssr-react-context/index.test.ts", "test/integration/ssr-ctx/test/index.test.js"] | Server-side rendering not working on production in [email protected] | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Operating System:
Platform: Windows
Arch: x64
Version: 20H2
Binaries:
Node: v14.17.6
npm: 8.1.3
Yarn: 1.22.17
Relevant packages:
next: 12.1.6
react: 17.0.2
react-dom: 17.0.2
### What browser are you using? (if relevant)
Chrome 102.0.5005.115
### How are you deploying your application? (if relevant)
next build
### Describe the Bug
When using server-side rendering with [email protected], the context doesn't get passed down to the children component.
When trying to log the context value, the context gets logged on the client-side but not on the server-side.
NOTE: This issue cannot be reproduced with other versions of nextjs and is only specific to 12.1.6.
The issue also gets resolved when upgrading react to the latest version i.e. 18.2.0.
This works with` next dev` but fails with `next build` && `next start`.
### Expected Behavior
The context should get passed down to the children on the server-side in production.
### Link to reproduction
https://github.com/sc-addypathania/nextjs-bug-repro/tree/main
### To Reproduce
1) npm run build
2) npm run start
3) Check the console/terminal the context is coming out to be undefined whereas its getting logged correctly on the browser | https://github.com/vercel/next.js/issues/38176 | https://github.com/vercel/next.js/pull/39221 | 582cb3766d683501076cd480915bd05ff7f04b7e | e9d23d709cdc0d64ad22277a4eb782c6261dd0fa | "2022-06-29T22:24:36Z" | javascript | "2022-08-01T14:21:42Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 38,167 | ["packages/next-bundle-analyzer/index.d.ts"] | @next/bundle-analyer type definitions causing build error | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
N/A
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
When compiling our code that depends on `@next/bundle-analyzer`, the types it ships with cause compilation errors.
<img width="1221" alt="Screenshot 2022-06-29 at 21 04 13" src="https://user-images.githubusercontent.com/74542468/176515921-e53bfcfd-69f3-4151-9083-7320d38dc04f.png">
This can be reproduced in isolation as well, on [the Typescript playground.](https://www.typescriptlang.org/play?filetype=d.ts#code/JYWwDg9gTgLgBDAnmApnA3nAcigHjAYQgDsAzYAczgF85SoIQ4ByYvGZgKE4GMSBneDnwAhAK7EAJgBsUAQWIBDaYgBeKKHAC8nOHAAUEMDGACA-AC4McFEoBGsyZbh2IEWYuIBuOEdsLlNQ1nV3cUTxoASm0APl0DPjJKZ2FCEnIKaK04vT1UoiSKbjxIWG1sdnEpWQCVdShOIA)
### Expected Behavior
The types should not cause a compilation error, neither locally, nor on the playground.
### Link to reproduction
https://www.typescriptlang.org/play?filetype=d.ts#code/JYWwDg9gTgLgBDAnmApnA3nAcigHjAYQgDsAzYAczgF85SoIQ4ByYvGZgKE4GMSBneDnwAhAK7EAJgBsUAQWIBDaYgBeKKHAC8nOHAAUEMDGACA-AC4McFEoBGsyZbh2IEWYuIBuOEdsLlNQ1nV3cUTxoASm0APl0DPjJKZ2FCEnIKaK04vT1UoiSKbjxIWG1sdnEpWQCVdShOIA
### To Reproduce
I can't share our code, but the TS playground link gives the same error. | https://github.com/vercel/next.js/issues/38167 | https://github.com/vercel/next.js/pull/38168 | 2150d1aee6d661b4bcd051fead79760557549983 | 157655700a031393ff6f0bb7e5a90b197bcbab06 | "2022-06-29T19:14:49Z" | javascript | "2022-06-30T20:48:00Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 38,130 | ["packages/next/server/lib/incremental-cache/file-system-cache.ts", "test/e2e/prerender.test.ts"] | Failed to update prerender cache for static dynamic routes | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
next.js v12.2.0
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
next start
### Describe the Bug
Just upgraded to the latest next.js version and I'm getting a lot of error messages like the following:
```
Failed to update prerender cache for /level/test/test-level-1 [Error: ENOENT: no such file or directory, open '<path_to_project>/.next/server/pages/level/test/test-level-1.html'] {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '<path_to_project>/.next/server/pages/level/test/test-level-1.html'
}
```
### Expected Behavior
I had never seen this error message before updating so I'm wondering if there's a regression, or maybe I'm supposed to update some code to handle the new version.
### Link to reproduction
https://github.com/sspenst/pathology
### To Reproduce
`next build; next start` and I see the message whenever the app tries to prefetch a static dynamic route for the first time. | https://github.com/vercel/next.js/issues/38130 | https://github.com/vercel/next.js/pull/38136 | c83f94cf8bd24ca77136793cc772db116403e366 | fcccaafa339d6fc4e56b50c9f4020f9b8819b83c | "2022-06-28T21:17:44Z" | javascript | "2022-06-29T09:45:15Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 38,117 | ["packages/next-swc/crates/core/src/auto_cjs/mod.rs", "packages/next-swc/crates/core/src/lib.rs"] | Next 12.2 ReferenceError: exports is not defined | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
Next 12.2(-12.2.2)
### Describe the Bug
I'm no longer able to import code with `exports` properly in Next 12.2
### Expected Behavior
Next should properly bundle these files
### Link to reproduction
https://github.com/hanford/12.2-exports
### To Reproduce
Pull reproduction repo and try running on Next `12.2.0`, you'll see the following error:
<img width="600" alt="image" src="https://user-images.githubusercontent.com/2148168/176248475-5e87229b-5f73-4316-a31d-cc7784aa630f.png">
You can check out the `working` branch, which just has Next `12.1.6`, after installing the older version the code will run without error.
--
Happy to provide more information if it's helpful! | https://github.com/vercel/next.js/issues/38117 | https://github.com/vercel/next.js/pull/38181 | 883a52ede99c218cc3b7cd1a8e867ac09fd76d7a | 9342a6ccc7f59e5de481577be61859cf5372be0e | "2022-06-28T17:41:43Z" | javascript | "2022-07-12T03:17:09Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 38,106 | ["packages/next/taskfile.js"] | Module parse failed: Unexpected token error when using next/link in storybook | ### Verify canary release
- [x] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
```
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:29 PDT 2022; root:xnu-8020.121.3~4/RELEASE_ARM64_T8101
Binaries:
Node: 16.15.0
npm: 8.5.5
Yarn: N/A
pnpm: N/A
Relevant packages:
next: 12.1.7-canary.51
eslint-config-next: 12.1.6
react: 18.2.0
react-dom: 18.2.0
react-dom: 18.2.0
```
### Describe the Bug
```
ERROR in ./node_modules/next/dist/shared/lib/router/router.js 37:8
Module parse failed: Unexpected token (37:8)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| class Router {
| // Server Data Cache
> sdc = {};
| isFirstPopStateEvent = true;
| _key = createKey();
@ ./node_modules/next/dist/client/link.js 7:14-52
@ ./node_modules/next/link.js
@ ./src/lib/utils/prismic/PrismicProvider/PrismicProvider.tsx
@ ./src/lib/components/Prismic/Prismic.tsx
@ ./devtools/storybook/preview.jsx
@ ./storybook-config-entry.js
@ multi ./node_modules/@storybook/core-client/dist/esm/globals/polyfills.js ./node_modules/@storybook/core-client/dist/esm/globals/globals.js (webpack)-hot-middleware/client.js?reload=true&quiet=false&noInfo=true ./storybook-config-entry.js```
```
### Expected Behavior
Run storybook without errors
### Link to reproduction
https://github.com/jeremytenjo/starter-website
### To Reproduce
1. Clone https://github.com/jeremytenjo/starter-website
2. Install Dependencies (npm i)
3. Run `npm run storybook:dev`
4. Open http://localhost:6006 | https://github.com/vercel/next.js/issues/38106 | https://github.com/vercel/next.js/pull/38137 | 6d8a234f82d93101993ab3daf356cd5199409d7b | 55769e2cac74cd01a6590baaff0a33696c6fed0c | "2022-06-28T12:29:08Z" | javascript | "2022-06-29T16:34:03Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 37,957 | ["examples/with-google-analytics/pages/_document.js"] | Google Analytics does not work with Next.js `Script` tag | ### Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
### Provide environment information
```
Operating System:
Platform: linux
Arch: x64
Version: #58~20.04.1-Ubuntu SMP Tue Jun 14 11:29:12 UTC 2022
Binaries:
Node: 16.14.2
npm: 8.5.0
Yarn: 1.22.5
pnpm: N/A
Relevant packages:
next: 12.1.6
react: 18.2.0
react-dom: 18.2.0
```
### What browser are you using? (if relevant)
Chrome 103.0.5060.53 (Official Build) (64-bit)
### How are you deploying your application? (if relevant)
Vercel
### Describe the Bug
If I use GA with `next/script` tag it won't work. But if I use normal `script` tag then it works.
### GA code snippet with `next/script` (not working)
```tsx
<Script
strategy="afterInteractive"
src={`https://www.googletagmanager.com/gtag/js?id=${process.env.GA_TRACKING_ID}`}
/>
<Script
id="ga-tracking"
strategy="afterInteractive"
dangerouslySetInnerHTML={{
__html: `
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${process.env.GA_TRACKING_ID}', {
page_path: window.location.pathname,
});
`,
}}
/>
```
### GA code snippet with regular `script` tag (working)
```tsx
<script
src={`https://www.googletagmanager.com/gtag/js?id=${process.env.GA_TRACKING_ID}`}
/>
<script
dangerouslySetInnerHTML={{
__html: `
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${process.env.GA_TRACKING_ID}', {
page_path: window.location.pathname,
});
`,
}}
/>
```
### Expected Behavior
Render the GA script in HTML.
### Link to reproduction
https://github.com/brenopolanski/brenopolanski.com/blob/develop/src/pages/_document.tsx#L36
### To Reproduce
1. Run the [project](https://github.com/brenopolanski/brenopolanski.com);
2. Inspect the page;
3. Look for `www.googletagmanager.com/gtag/` under the `Elements` tab.

| https://github.com/vercel/next.js/issues/37957 | https://github.com/vercel/next.js/pull/43838 | 297459d534e5d88b5bdaa1baa1e03f5eea142c12 | ee266b9d9b3ceefa6410cf0f186468e46d18d279 | "2022-06-23T15:58:27Z" | javascript | "2022-12-13T02:53:42Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 37,884 | ["packages/create-next-app/create-app.ts", "packages/create-next-app/helpers/examples.ts", "test/integration/create-next-app/index.test.ts"] | with-docker-compose could not be downloaded | ### Verify canary release
- [X] I verified that the issue exists in Next.js canary release
### Provide environment information
node v16.131
npm v8.1.2
### Which example does this report relate to?
with-docker-compose
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
When I run below command, could not locate an example named "with-docker-compose" error is prompted
$ npx create-next-app --example with-docker-compose with-docker-compose-app
Could not locate an example named "with-docker-compose". It could be due to the following:
1. Your spelling of example "with-docker-compose" might be incorrect.
2. You might not be connected to the internet or you are behind a proxy.
### Expected Behavior
with-docker-compose example could be downloaded without errors
### To Reproduce
Run below command:
$ npx create-next-app --example with-docker-compose with-docker-compose-app | https://github.com/vercel/next.js/issues/37884 | https://github.com/vercel/next.js/pull/37910 | 7c20918bc787d24403fab170e7840f946886dcef | f15fb7c65a7353276183065841714bb0099f1104 | "2022-06-21T16:47:29Z" | javascript | "2022-06-23T17:28:14Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 37,805 | ["packages/next/server/body-streams.ts", "test/e2e/proxy-request-with-middleware/app/middleware.js", "test/e2e/proxy-request-with-middleware/app/pages/api/index.js", "test/e2e/proxy-request-with-middleware/app/pages/api/post.js", "test/e2e/proxy-request-with-middleware/test/index.test.ts"] | Reading request bodies in middleware breaks API requests | ### Verify canary release
- [X] I verified that the issue exists in Next.js canary release
### Provide environment information
```log
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.4.0: Fri Mar 18 00:45:05 PDT 2022; root:xnu-8020.101.4~15/RELEASE_X86_64
Binaries:
Node: 16.15.1
npm: 8.11.0
Yarn: 1.22.15
pnpm: 7.2.1
Relevant packages:
next: 12.1.7-canary.41
react: 17.0.2
react-dom: 17.0.2
```
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
I'm trying to implement ory kratos self-service login flow. As their documentation, I used [@ory/integrations](https://www.npmjs.com/package/@ory/integrations) package to integrate with Next.js. The integration basically utilizes the next API paths to proxy incoming requests to ory kratos instance. This approach works fine until `[email protected]`. This release brings the ability to read the body in middleware https://github.com/vercel/next.js/pull/34519. This feature breaks the ability to correctly proxy requests (specifically `pip` and other req functions usage).
### Expected Behavior
Should be able to utilize the full functionality of request `IncomingMessage` API without losing context.
### Link to reproduction
https://github.com/AliYusuf95/kratos-selfservice-ui-react-nextjs
### To Reproduce
1- Try to send a `POST` request method to http://localhost:3000/api/test and observe the response method and headers, then remove/rename `middleware.ts` file and try again.
2- Follow the documentation page to run [ory kratos instance](https://www.ory.sh/nextjs-authentication-spa-custom-flows-open-source/#ory-kratos-on-your-machine), the project will not work if `middleware.ts` is present. | https://github.com/vercel/next.js/issues/37805 | https://github.com/vercel/next.js/pull/37806 | 7e3355dd9fdd6da8fea1c995b805ea30fef5827d | d7e83704bf8c20cc885bd3e5c82e99d0a23afa97 | "2022-06-18T10:27:25Z" | javascript | "2022-06-27T20:56:14Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 37,804 | ["packages/next/client/index.tsx", "packages/next/client/next-dev.js", "packages/next/server/web/adapter.ts", "packages/next/shared/lib/router/router.ts", "test/e2e/middleware-general/app/middleware.js", "test/e2e/middleware-general/app/pages/ssg/[slug].js", "test/e2e/middleware-general/test/index.test.ts"] | 12.1.7-canary.41 Edge middleware NextResponse.rewrite cause endless rewrite loop | ### Verify canary release
- [X] I verified that the issue exists in Next.js canary release
### Provide environment information
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:22 PDT 2022; root:xnu-8020.121.3~4/RELEASE_X86_64
Binaries:
Node: 16.14.2
npm: 8.9.0
Yarn: 1.22.18
pnpm: N/A
Relevant packages:
next: 12.1.7-canary.41
react: 18.2.0
react-dom: 18.2.0
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
Vercel
### Describe the Bug
In root middleware.ts, use `NextResponse.rewrite` to my own subpage, it goto subpage first, and then auto redirect to index. If no index exists, it will run into an endless redirect loop. That's horrible.
This issue exists in `[email protected]`.
`[email protected]` doesn't have this issue.
### Expected Behavior
Rewrite to target page.
### Link to reproduction
https://reproduce-issue-endless-rewrite.vercel.app
### To Reproduce
Complete code:
https://github.com/maintao/reproduce-issue-endless-rewrite | https://github.com/vercel/next.js/issues/37804 | https://github.com/vercel/next.js/pull/37815 | 3bf0fcf35db9e4b03b1fe99486bdb3e65e86c295 | 122899bd37c70e12e6ac3d9503931bd0d4ac424b | "2022-06-18T07:07:58Z" | javascript | "2022-06-20T11:31:19Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 37,753 | ["packages/next/client/index.tsx", "packages/next/shared/lib/router/router.ts", "test/e2e/middleware-general/app/middleware.js", "test/e2e/middleware-general/app/pages/ssg/[slug].js", "test/e2e/middleware-general/test/index.test.ts", "test/e2e/middleware-rewrites/app/pages/index.js", "test/integration/dynamic-routing/test/index.test.js", "test/integration/dynamic-routing/test/middleware.test.js", "test/integration/middleware-prefetch/tests/index.test.js"] | Middleware breaks dynamic routes param matching | ### Verify canary release
- [X] I verified that the issue exists in Next.js canary release
### Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 21.3.0: Wed Jan 5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_ARM64_T8101
Binaries:
Node: 16.15.0
npm: 8.5.5
Yarn: 1.22.10
pnpm: N/A
Relevant packages:
next: 12.1.7-canary.40
react: 17.0.2
react-dom: 17.0.2
### What browser are you using? (if relevant)
Brave Version 1.39.111 Chromium: 102.0.5005.61 (Official Build) (arm64)
### How are you deploying your application? (if relevant)
next dev
### Describe the Bug
Adding `middleware.ts` to root of project breaks dynamic routes like `[id]`. The pages are correctly routed but `router.query` returns empty object even if the dynamic route matched the URL.
This behavior started appearing in [v12.1.7-canary.34](https://github.com/vercel/next.js/releases/tag/v12.1.7-canary.34). Likely PR that broke this is https://github.com/vercel/next.js/pull/37574
### Expected Behavior
`router.query` from `useRouter` should return `{ id: 'first' }` if I go to `/post/first` and there is file `pages/post/[id].js`
### To Reproduce
I reproduced using dynamic routing example: https://github.com/vercel/next.js/tree/canary/examples/dynamic-routing
Then bumping next version to `12.1.7-canary.40` and adding `middleware.ts` to root:
```
import { NextResponse } from 'next/server'
export async function middleware() {
return NextResponse.next()
}
```
Then I run `yarn next dev` and go to http://localhost:3000/post/first
There should be "Post: first" but there is just "Post: " because `router.query === {}`

| https://github.com/vercel/next.js/issues/37753 | https://github.com/vercel/next.js/pull/37784 | c2b80064853301e746ca100b6a49de04b8f5b593 | 85e643be83f8ff009463e5700c436c39fb0ea11e | "2022-06-16T14:59:26Z" | javascript | "2022-06-17T15:28:25Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 37,720 | ["packages/next/server/base-server.ts", "packages/next/shared/lib/router/router.ts", "test/e2e/middleware-general/app/middleware.js", "test/e2e/middleware-general/app/next.config.js", "test/e2e/middleware-general/test/index.test.ts"] | Middleware rewrite doesn't take `searchParams` when target page is a non-SSR page. | ### Verify canary release
- [x] I verified that the issue exists in Next.js canary release
### Provide environment information
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.2.0: Sun Nov 28 20:28:54 PST 2021; root:xnu-8019.61.5~1/RELEASE_X86_64
Binaries:
Node: 17.8.0
npm: 8.5.5
Yarn: 1.22.18
pnpm: N/A
Relevant packages:
next: 12.1.6
react: 18.2.0
react-dom: 18.2.0
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
The `searchParams` is not taken when target page of `NextResponse.rewrite()` is a non-SSR page.
In this `_middleware.ts`, we want to rewrite all requests to "/login?hello=world", but in fact we can only go to "/login" without the query parameter "?hello=world".
```typescript
// _middleware.ts
import { NextRequest, NextResponse } from 'next/server';
export async function middleware(request: NextRequest) {
console.log('_middleware:', request.nextUrl.href);
const newUrl = request.nextUrl.clone();
newUrl.searchParams.set('hello','world');
newUrl.pathname = '/login';
const response = NextResponse.rewrite(newUrl);
console.log('_middleware:', newUrl.toString());
return response;
}
```
I wanted to try it on canary version, but I found the middleware api is changed in canary and I couldn't find the corresponding document for that.
### Expected Behavior
Expect we can get "?hello=world" at rewrite target "/login" page.
### To Reproduce
I created this minimal reproducible project, please have a check:
https://github.com/meikidd/nextjs-middleware-rewrite | https://github.com/vercel/next.js/issues/37720 | https://github.com/vercel/next.js/pull/37724 | 87d8c2bb2acd29e94c1b6a546babe6aaa661c804 | 808e558ade1b7563bf9ff8ed86d70dd3c7dba647 | "2022-06-15T15:40:18Z" | javascript | "2022-06-15T19:32:44Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 37,483 | ["packages/next/server/config.ts", "test/integration/i18n-support/test/index.test.js"] | Locale listed twice will trigger an obscure build error | ### Verify canary release
- [X] I verified that the issue exists in Next.js canary release
### Provide environment information
```
Operating System:
Platform: linux
Arch: x64
Version: #49~20.04.1-Ubuntu SMP Wed May 18 18:44:28 UTC 2022
Binaries:
Node: 16.14.2
npm: 8.5.0
Yarn: 3.2.0
pnpm: N/A
Relevant packages:
next: 12.1.6
react: 17.0.2
react-dom: 17.0.2
warn - Latest canary version not detected, detected: "12.1.6", newest: "12.1.7-canary.29".
Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue.
Read more - https://nextjs.org/docs/messages/opening-an-issue
```
=> Canary release gives me another `**Error: nested Middleware is not allowed**`so I couldn't test on a newer version, sorry.
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
When `i18n.locales` contains the same value twice, it will trigger an error similar to https://github.com/vercel/next.js/issues/12717
This is because the built file as already been moved from `.next/export/` to `.next/server/pages`.
This can happen if you compute the locales list from regions, for instance `["zh-Hans", "zh-Hant"].map(l => l.slice(0,2)`, you will have `zh` country code twice.
### Expected Behavior
Have a cleaner warning, similar to when we forget to put the defaultLocale into the locales list
### To Reproduce
In `next.config.js` `i18n.locales`, put the same locale twice and try to build an app. | https://github.com/vercel/next.js/issues/37483 | https://github.com/vercel/next.js/pull/37485 | 5d0c3edda3809952a566cf78dac4e60b7c75feb4 | 42f838e15632f0289a3da359d95000e6a833e7b5 | "2022-06-06T15:30:30Z" | javascript | "2022-06-07T17:58:19Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 37,421 | ["examples/with-redux/package.json"] | TypeError : 'Component' cannot be used as JSX component | ### Verify canary release
- [X] I verified that the issue exists in Next.js canary release
### Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #1 SMP Wed Aug 25 23:20:18 UTC 2021
Binaries:
Node: 14.18.2
npm: 8.3.0
Yarn: 1.22.17
pnpm: N/A
Relevant packages:
next: 12.1.6
react: 17.0.2
react-dom: 17.0.2
### Which example does this report relate to?
with-redux
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
I am using nextjs example [with-redux](https://github.com/vercel/next.js/tree/canary/examples/with-redux) . The current version of devDependencies `@types/react` and `@types/react-dom` gives type error ` Type Error 'Component' cannot be used as a JSX component.`
Below is screenshot showing error

The problem can be solved by upgrading the `@types/react` and `@types/react-dom` dependencies
### Expected Behavior
TypeError should not occur
### To Reproduce
If you do not see the typeError after cloning this example repository run next build to see typeError while build process . | https://github.com/vercel/next.js/issues/37421 | https://github.com/vercel/next.js/pull/37423 | 6a39d5181f038c3ea0cca242442c32f69ac80d80 | e9659113f0e13f985c523ec140cc6d979ab41e07 | "2022-06-03T08:31:50Z" | javascript | "2022-06-20T14:12:56Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 37,409 | ["packages/next/build/swc/options.js"] | Experimental SWC Plugins: failed to process failed to invoke plugin: Impossible to get the node_modules path | ### Verify canary release
- [X] I verified that the issue exists in Next.js canary release
### Provide environment information
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:37 PDT 2022; root:xnu-8020.121.3~4/RELEASE_ARM64_T6000
Binaries:
Node: 16.13.0
npm: 8.1.3
Yarn: 1.22.17
pnpm: N/A
Relevant packages:
next: 12.1.7-canary.29
react: 18.1.0
react-dom: 18.1.0
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
experimental swc plugins are not able to resolve node module paths
as soon as a subpath of a npm module is given next crashes with the following error message:
```
thread '<unnamed>' panicked at 'failed to invoke plugin: Impossible to get the node_modules path', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.181.2/src/plugin.rs:212:14
```
### Expected Behavior
it would be nice if we could add feature parity with babel plugins and allow node module paths
### To Reproduce
```bash
npm install css-variable
```
next.config.js
```js
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
experimental: {
swcPlugins: [
["css-variable/swc", { displayName: false, basePath: __dirname }]
]
}
}
module.exports = nextConfig
``` | https://github.com/vercel/next.js/issues/37409 | https://github.com/vercel/next.js/pull/37412 | ad728f4e61425e757487200988f3b5fd067e777a | 3b7254538d3cd0821616359fe5085ed9e877a44a | "2022-06-02T16:47:52Z" | javascript | "2022-06-21T15:37:13Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 37,371 | ["packages/react-dev-overlay/src/internal/components/LeftRightDialogHeader/LeftRightDialogHeader.tsx", "packages/react-dev-overlay/src/internal/container/Errors.tsx", "packages/react-dev-overlay/src/internal/icons/CloseIcon.tsx", "packages/react-dev-overlay/src/internal/styles/Base.tsx", "test/development/client-dev-overlay/app/pages/index.js", "test/development/client-dev-overlay/index.test.ts"] | Provide a way to clear error box | ### Describe the feature you'd like to request
There should be a way to acknowledge and actually clear this box.
<img width="245" alt="Screenshot 2022-06-01 at 16 39 14" src="https://user-images.githubusercontent.com/810438/171444728-bae268fe-d5f7-40a0-ba04-0c43a35b255e.png">
At FB we have a close button on it.
This is useful when you've read the error but the UI you're testing has something underneath and you just need to iterate peacefully.
### Describe the solution you'd like
Add a close button.
### Describe alternatives you've considered
Keep as is | https://github.com/vercel/next.js/issues/37371 | https://github.com/vercel/next.js/pull/37417 | 6914a25dd2c64775d3bf4b8f7bad4611c641017c | be5dedf6764db1797b5c9fb5c5b8ec1fa9809a20 | "2022-06-01T15:42:13Z" | javascript | "2022-06-06T18:21:53Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 37,338 | ["packages/next/src/server/lib/mock-request.ts", "packages/next/src/server/send-payload/revalidate-headers.ts", "run-tests.js", "test/e2e/prerender.test.ts", "test/e2e/prerender/pages/ssr.js"] | ISR unstable_revalidate -- TypeError: res.hasHeader is not a function | ### Verify canary release
- [X] I verified that the issue exists in Next.js canary release
### Provide environment information
```
Operating System:
Platform: linux
Arch: x64
Version: #1 SMP Tue Jun 23 12:58:10 UTC 2020
Binaries:
Node: 14.17.3
npm: 6.14.13
Yarn: 1.22.17
pnpm: N/A
Relevant packages:
next: 12.1.5
react: 18.0.0
react-dom: 18.0.0
```
### What browser are you using? (if relevant)
Chrome 102.0.5005.61
### How are you deploying your application? (if relevant)
Vercel
### Describe the Bug
I am attempting to use `res.unstable_revalidate` to revalidate an ISR generated page. When invoking the function, the following error is returned ->
```typescript
export default async function handler(
req: NextApiRequest,
res: NextApiResponse
) {
if (req.query.secret !== process.env.ISR_REVALIDATION) {
return res.status(401).json({ message: 'Invalid token' });
}
if (!req.body.path) {
return res
.status(400)
.json({ message: 'Please provide a path to revalidate' });
}
try {
await res.unstable_revalidate(req.body.path);
return res.json({
message: `${req.body.path} Revalidated`,
revalidated: true,
});
} catch (err) {
// If there was an error, Next.js will continue
// to show the last successfully generated page
return res.status(500).send('Error revalidating');
}
}
```
```node
TypeError: res.hasHeader is not a function
```
The error will not be returned if I pass just the index route, ```/```. However, any other path that is passed in from a ISR page will return ```TypeError: res.hasHeader is not a function```
Full stack trace
```bash
at handler (webpack-internal:///(api)/./src/pages/api/revalidate.ts:30:21)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Object.apiResolver (/node_modules/next/dist/server/api-utils/node.js:185:9)
at async DevServer.runApi (/node_modules/next/dist/server/next-server.js:404:9)
at async Object.fn (/node_modules/next/dist/server/base-server.js:507:37)
at async Router.execute (/node_modules/next/dist/server/router.js:212:36)
at async DevServer.run (/node_modules/next/dist/server/base-server.js:642:29)
at async DevServer.run (/node_modules/next/dist/server/dev/next-dev-server.js:514:20)
at async DevServer.handleRequest (/node_modules/next/dist/server/base-server.js:334:20)
```
### Expected Behavior
To run the function and trigger a revalidation
### To Reproduce
Trigger `res.unstable_revalidate` and pass whatever path you want to revalidate. | https://github.com/vercel/next.js/issues/37338 | https://github.com/vercel/next.js/pull/45681 | e36fb42e30e7b69f6484275df960bc91ab81ee86 | 434a8cb7d0764993b8cb39fe1ec520eb667de703 | "2022-05-31T13:29:21Z" | javascript | "2023-02-08T01:51:26Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 37,309 | ["docs/basic-features/eslint.md", "packages/eslint-plugin-next/lib/index.js", "packages/eslint-plugin-next/lib/rules/no-server-import-in-page.js", "test/unit/eslint-plugin-next/no-server-import-in-page.test.ts"] | @next/next/no-server-import-in-page ESLint rule throws on test files | ### Verify canary release
- [X] I verified that the issue exists in Next.js canary release
### Provide environment information
```
Operating System:
Platform: linux
Arch: x64
Version: #1 SMP Tue Jun 23 12:58:10 UTC 2020
Binaries:
Node: 16.14.2
npm: 8.5.0
Yarn: 3.2.0
pnpm: N/A
Relevant packages:
next: 12.1.6
react: 18.1.0
react-dom: 18.1.0
```
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
Vercel
### Describe the Bug
When a test file in the pages folder exists that imports `next/server`, the rule `@next/next/no-server-import-in-page` throws during `next build`.
### Expected Behavior
Test files, either those in `__tests__` or `file.test.ts` should be ignored for this rule
### To Reproduce
package.json
```
"@typescript-eslint/parser": "^5.25.0",
"eslint": "^8.15.0",
"eslint-config-next": "^12.1.6",
"eslint-plugin-react": "^7.29.4",
```
.eslint.json
```json
{
"root": true,
"extends": "next/core-web-vitals",
"parser": "@typescript-eslint/parser"
}
```
Create a file at `pages/__tests__/example.test.ts`
```ts
import "jest";
import { NextRequest } from "next/server";
describe("example", () => {
it("should pass", () => {});
});
```
Run next build or deploy to Vercel | https://github.com/vercel/next.js/issues/37309 | https://github.com/vercel/next.js/pull/38028 | d57342a94e60c42b14fccc60a038bf601f0b7449 | 22206651a69a8a15e8da396de8cab9b4faacd26a | "2022-05-30T14:16:25Z" | javascript | "2022-06-26T12:43:15Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 37,296 | ["packages/next/lib/typescript/writeConfigurationDefaults.ts", "test/development/correct-tsconfig-defaults/index.test.ts"] | The automatically generated `tsconfig.json` file is missing `moduleResolution` | ### Verify canary release
- [X] I verified that the issue exists in Next.js canary release
### Provide environment information
```
$ next info
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:22 PDT 2022; root:xnu-8020.121.3~4/RELEASE_X86_64
Binaries:
Node: 16.15.0
npm: 8.5.5
Yarn: 1.22.17
pnpm: 7.0.0
Relevant packages:
next: 12.1.7-canary.23
react: 18.1.0
react-dom: 18.1.0
```
### What browser are you using? (if relevant)
N/A
### How are you deploying your application? (if relevant)
N/A
### Describe the Bug
Follow the instructions to install TypeScript, try starting the development server again.
View the generated `tsconfig.json` file:
> Option '--resolveJsonModule' cannot be specified without 'node' module resolution strategy.ts
<img width="1792" alt="image" src="https://user-images.githubusercontent.com/38807139/170955941-a9d2c9fd-8582-488b-9121-6cf145fc4740.png">
### Expected Behavior
The generated `tsconfig.json` file should contain the `moduleResolution` key.
### To Reproduce
```
# If you’re using npm
npm install --save-dev typescript @types/react @types/node
# If you’re using Yarn
yarn add --dev typescript @types/react @types/node
npm/yarn run dev
```
View the `tsconfig.json` file | https://github.com/vercel/next.js/issues/37296 | https://github.com/vercel/next.js/pull/39836 | cb1038cb6d21bd6f51b70b3d4e52e03a46dc22b0 | 31bcd044ffbd0a145d9b93515251223d9de666a8 | "2022-05-30T08:57:33Z" | javascript | "2022-08-22T23:36:36Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 37,288 | ["docs/basic-features/data-fetching/get-static-paths.md"] | Docs: getStaticPaths "When does getStaticPaths run" error | ### What is the improvement or update you wish to see?
The [When does getStaticPaths run](https://nextjs.org/docs/basic-features/data-fetching/get-static-paths#when-does-getstaticpaths-run) section in the docs lists bullet points for getStaticProps instead of getStaticPaths.
### Is there any context that might help us understand?
See https://nextjs.org/docs/basic-features/data-fetching/get-static-paths#when-does-getstaticpaths-run
"getStaticPaths will only run during build in production, it will not be called during runtime.
You can validate code written inside getStaticPaths is removed from the client-side bundle with this tool.
- **getStaticProps** runs during next build for any paths returned during build
- **getStaticProps** runs in the background when using fallback: true
- **getStaticProps** is called before initial render when using fallback: blocking"
### Does the docs page already exist? Please link to it.
https://nextjs.org/docs/basic-features/data-fetching/get-static-paths#when-does-getstaticpaths-run | https://github.com/vercel/next.js/issues/37288 | https://github.com/vercel/next.js/pull/37289 | d1b7e7f69607970043a26bd5b3bfb97af4cbab3c | f4dcb81d6119cd952f8dd968920beda9412be244 | "2022-05-29T21:38:52Z" | javascript | "2022-05-29T22:17:29Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 37,271 | ["packages/next/src/lib/typescript/writeConfigurationDefaults.ts", "test/integration/tsconfig-verifier/test/index.test.js"] | TypeScript Target Compiler Option is Silently Ignored | ### Verify canary release
- [X] I verified that the issue exists in Next.js canary release
### Provide environment information
Operating System:
Platform: win32
Arch: x64
Version: Windows 10 Home
Binaries:
Node: 16.13.0
npm: N/A
Yarn: N/A
pnpm: N/A
Relevant packages:
next: 12.1.7-canary.19
react: 18.1.0
react-dom: 18.1.0
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
next export
### Describe the Bug
Changing the `tsconfig.json` -> `compilerOptions` -> `target` setting has no effect on static export builds and no error or warning occurs to indicate this.
This is my first time filing a bug report, so please let me know if I'm doing anything wrong or unhelpful!
### Expected Behavior
Changing the TypeScript build target should be respected by the build engine like other TypeScript configuration settings, or an error or warning should indicate that the TypeScript target must always be a certain value.
### To Reproduce
- Create a new project: `npx create-next-app@canary --typescript`
- Modify the `build` script in `package.json` to be `next build && next export`
- Remove the `Image` import and `Image` tag from `index.tsx` because it will prevent static build from succeeding
- Modify `pages/_app.tsx` with a trivial piece of functionality which uses an `ES2022` feature
```
import '../styles/globals.css'
import type { AppProps } from 'next/app'
import { useEffect, useState } from 'react';
class Test {
#forMeOnly = true;
doSomething(): void {
console.log("FOR ME ONLY", this.#forMeOnly);
}
}
function MyApp({ Component, pageProps }: AppProps) {
const [test] = useState(new Test());
useEffect(() => test.doSomething());
return <Component {...pageProps} />
}
export default MyApp
```
- Modify `compilerOptions` -> `target` in `tsconfig.json` to be `ES2022`
- Execute `npm run build`
- Note that in the chunk exported for `_app-<cache-bust>.js` in `out/_next/static/chunks/pages` that the private field `#forMeOnly` is enforced using `WeakMap` and not using the native JavaScript feature from `ES2022`
- Expected to see `#forMeOnly` (or a minified version) and no `WeakMap` | https://github.com/vercel/next.js/issues/37271 | https://github.com/vercel/next.js/pull/44567 | baccea324f344dc461ff6ecbcf0ef1e878b9982f | 4e879ec364162b77edb92306544cfde88752b946 | "2022-05-28T17:56:02Z" | javascript | "2023-01-04T23:08:14Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 37,248 | ["packages/next/client/link.tsx"] | Next Link component has unknown-prop warning when using `legacyBehavior={false}` | ### Verify canary release
- [X] I verified that the issue exists in Next.js canary release
### Provide environment information
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.4.0: Fri Mar 18 00:45:05 PDT 2022; root:xnu-8020.101.4~15/RELEASE_X86_64
Binaries:
Node: 16.13.1
npm: 8.1.2
Yarn: 1.22.17
pnpm: N/A
Relevant packages:
next: 12.1.7-canary.18
react: 17.0.2
react-dom: 17.0.2
### Which example does this report relate to?
hello-world
### What browser are you using? (if relevant)
Chrome 97.0.4692.71
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
Passing a value of `false` to the `legacyBehavior` prop on the [Link component](https://nextjs.org/docs/api-reference/next/link) results in an [unknown-prop warning](https://reactjs.org/warnings/unknown-prop.html) from React.
### Expected Behavior
There should be no warning about an unknown-prop.
### To Reproduce
1. Visit the [StackBlitz link](https://stackblitz.com/edit/github-fjl3go?file=pages/index.js)
2. Navigate to the `index.js` file (if not there already)
3. Observe the unknown-prop warning in the terminal related to `legacyBehavior`
Screenshot:

| https://github.com/vercel/next.js/issues/37248 | https://github.com/vercel/next.js/pull/37306 | 96cabcdede127cf83e8cf39dd2f70c309f795a42 | a7ee8bfd1ddfc2229d4ed816ab458a1e6415ac87 | "2022-05-27T15:50:08Z" | javascript | "2022-05-30T14:09:14Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 37,123 | ["packages/next/lib/pick.ts", "packages/next/server/web/sandbox/context.ts", "test/e2e/middleware-fetches-with-any-http-method/index.test.ts"] | When fetching a Request object in middleware, the method is ignored | ### Verify canary release
- [X] I verified that the issue exists in Next.js canary release
### Provide environment information
Operating System:
Platform: win32
Arch: x64
Version: Windows 10 Enterprise
Binaries:
Node: 16.14.0
npm: N/A
Yarn: N/A
pnpm: N/A
Relevant packages:
next: 12.1.7-canary.11
react: 17.0.2
react-dom: 17.0.2
### What browser are you using? (if relevant)
n/a
### How are you deploying your application? (if relevant)
next start
### Describe the Bug
When fetching a Request object in middleware, the method is ignored:
```ts
const request = new Request('http://example.com', { method: 'POST', body: 'hello'})
const response = await fetch(request)
expect(response.req.method).toEqual('POST') // <-- return 'GET'
```
This is related to #36522 (case 2 here, which I believe was lost in the shuffle).
### Expected Behavior
Specified 'method' should be used for the request
### To Reproduce
A simple repro we have in a middleware.ts:
```ts
import { NextResponse } from 'next/server';
export default async function () {
const ok = await fetch('https://httpbin.org/post', {
method: 'POST',
body: 'test',
});
console.log(ok); // <-- 200 OK
const fails = await fetch(
new Request('https://httpbin.org/post', {
method: 'POST',
body: 'test',
})
);
console.log(fails); // <-- 405 METHOD NOT ALLOWED (GET is sent)
return NextResponse.next();
}
``` | https://github.com/vercel/next.js/issues/37123 | https://github.com/vercel/next.js/pull/37540 | 01ecff3b095113d64e26a73b07f1fa84d6d62f6b | 88d0440ad4adf5c9ad6d9bf93babe9c48a9607f3 | "2022-05-23T13:49:01Z" | javascript | "2022-06-08T11:00:49Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 37,122 | ["packages/next/build/index.ts", "packages/next/lib/typescript/getTypeScriptIntent.ts", "packages/next/lib/verifyTypeScriptSetup.ts", "packages/next/server/dev/next-dev-server.ts", "test/integration/typescript/test/index.test.js"] | TypeScript + `exprimental.workerThreads` might cause build fail [Next.js 12.1.7-canary.11 only] | ### Verify canary release
- [X] I verified that the issue exists in Next.js canary release
### Provide environment information
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.4.0: Fri Mar 18 00:45:05 PDT 2022; root:xnu-8020.101.4~15/RELEASE_X86_64
Binaries:
Node: 16.15.0
npm: 8.5.1
Yarn: 1.18.0
pnpm: 7.1.0
Relevant packages:
next: 12.1.7-canary.11
react: 18.1.0
react-dom: 18.1.0
### What browser are you using? (if relevant)
_No response_
### How are you deploying your application? (if relevant)
_No response_
### Describe the Bug
#37105 introduces running typescript checks in a dedicated worker to speed up building.
However, the method `verifyTypeScriptSetup` exposed by the worker requires passing in a Next.js config object which might/will contain functions (`webpack`, `exportPathsMap`, `generateBuildId`, etc.), which is can not be passed from the main thread to the worker, results in a failed build with following error message:
```
> Build error occurred
DOMException [DataCloneError]:
```
I am currently implementing a fix: https://github.com/SukkaW/next.js/tree/fix-next-config-worker
### Expected Behavior
The build should succeed.
### To Reproduce
Using custom build id, custom webpack config, `exportPathsMap`, etc. in the `next.config.js`. | https://github.com/vercel/next.js/issues/37122 | https://github.com/vercel/next.js/pull/37125 | d64512f02fbd580e55d8cda2c51b338f43f26598 | e57e2753f12076a99173a80787e6d1a2cdb3a0fc | "2022-05-23T13:20:09Z" | javascript | "2022-05-23T20:30:48Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 37,064 | ["docs/advanced-features/middleware.md"] | Docs: Hard to know that Middleware doesn't support Node.js APIs | ### What is the improvement or update you wish to see?
Middleware (beta) document should tell us that it doesn't support Node.js APIs.
### Is there any context that might help us understand?
Someone like me, when we first hear about the concept about 'Middleware' we naturally think of it as 'a thing running on a server' (and which is basically correct). So if it doesn't support browser-only APIs, yes we may be a bit sad but still can forgive that. But in reality, middleware API do support browser APIs like 'fetch' while it doesn't support Node.js API and that is so unforeseeable.
I won't exclaim 'Middleware API do need to support Node.js APIs' here, but at least docs should let people be aware of the fact. For now 'unsupported APIs' information is only written in the document of [Edge Runtime](https://nextjs.org/docs/api-reference/edge-runtime#unsupported-apis) where majority of the middleware-api-starters may not take a look at (and it's even on the very very bottom of a page, it feels like it's not a big deal.)
### Does the docs page already exist? Please link to it.
https://nextjs.org/docs/advanced-features/middleware | https://github.com/vercel/next.js/issues/37064 | https://github.com/vercel/next.js/pull/37251 | 523704b83f2ee3127f079ee74a74c657eaf9aece | 4f4c507064121d9de0ad700de813b5e9f1062585 | "2022-05-20T12:18:55Z" | javascript | "2022-05-27T18:36:14Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 37,025 | ["packages/next/server/dev/next-dev-server.ts", "packages/next/server/next-server.ts", "test/integration/middleware-general/test/index.test.js"] | Runtime error when middleware and catch-all route present and invalid URI requested | ### Verify canary release
- [X] I verified that the issue exists in Next.js canary release
### Provide environment information
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.4.0: Fri Mar 18 00:45:05 PDT 2022; root:xnu-8020.101.4~15/RELEASE_X86_64
Binaries:
Node: 16.13.0
npm: 8.1.0
Yarn: 1.22.17
pnpm: N/A
Relevant packages:
next: 12.1.6
react: 17.0.2
react-dom: 17.0.2
### What browser are you using? (if relevant)
Chrome 101.0.4951.64 (Official Build) (x86_64)
### How are you deploying your application? (if relevant)
next start
### Describe the Bug
When `pages/_middleware.ts` and a catch-all route (`pages/[...slug].tsx`) is present, an invalid URI that fails `decodeURIComponent` causes a runtime error. Removing the catch-all route or middleware resolves the issue.
```
error - DecodeError: failed to decode param
at decode (/Users/devin.pitcher/Code/my-app/node_modules/next/dist/shared/lib/router/utils/route-matcher.js:18:23)
at /Users/devin.pitcher/Code/my-app/node_modules/next/dist/shared/lib/router/utils/route-matcher.js:28:21
at Array.forEach (<anonymous>)
at Object.match (/Users/devin.pitcher/Code/my-app/node_modules/next/dist/shared/lib/router/utils/route-matcher.js:22:29)
at DevServer.runMiddleware (/Users/devin.pitcher/Code/my-app/node_modules/next/dist/server/next-server.js:837:50)
at async DevServer.runMiddleware (/Users/devin.pitcher/Code/my-app/node_modules/next/dist/server/dev/next-dev-server.js:435:28)
at async Object.fn (/Users/devin.pitcher/Code/my-app/node_modules/next/dist/server/next-server.js:710:30)
at async Router.execute (/Users/devin.pitcher/Code/my-app/node_modules/next/dist/server/router.js:226:36)
at async DevServer.run (/Users/devin.pitcher/Code/my-app/node_modules/next/dist/server/base-server.js:636:29)
at async DevServer.run (/Users/devin.pitcher/Code/my-app/node_modules/next/dist/server/dev/next-dev-server.js:483:20) {
middleware: true
}
```
### Expected Behavior
`http://localhost:3000/%C0` should return a `HTTP 400` error. When both middleware and a catch-all route are present, a runtime error occurs. Removing either one will result in a `HTTP 400` error as expected.
### To Reproduce
```
yarn create next-app --typescript
cd my-app
yarn add next@canary --save
```
`pages/_middleware.ts`
```typescript
import { NextResponse, NextFetchEvent, NextRequest } from 'next/server'
const middleware = (req: NextRequest, ev: NextFetchEvent) => {
return NextResponse.next();
}
export default middleware;
```
`pages/[...slug].tsx`
```typescript
import type { NextPage } from 'next';
const CatchAll: NextPage = () => {
return (
<h1>Hello, world!</h1>
)
}
export default CatchAll;
```
```
yarn dev --port 1337
```
Open browser to `http://localhost:1337/%C0` | https://github.com/vercel/next.js/issues/37025 | https://github.com/vercel/next.js/pull/36993 | 5b893663fdb3658de4e8ce2bb5966fbfe4e905ef | 7e57432247cf4b418ee614a43dc82df9128e61d1 | "2022-05-18T22:47:23Z" | javascript | "2022-05-22T03:25:51Z" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.