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 | 27,696 | ["packages/next/lib/load-custom-routes.ts", "test/integration/invalid-custom-routes/test/index.test.js"] | Unclear error message when deploying to Vercel | ### What version of Next.js are you using?
11.0.1
### What version of Node.js are you using?
n/a
### What browser are you using?
n/a
### What operating system are you using?
linux (on vercel)
### How are you deploying your application?
Vercel
### Describe the Bug
See https://github.com/getsentry/sentry-javascript/issues/3851.
When deploying their app to Vercel, one of our users is getting the error message:
```
Error! Builder returned invalid routes: should NOT be longer than 4096 characters
```
We're unable to replicate this behavior, and are having trouble debugging their issue, in part because the error message they're getting isn't totally clear. Specifically, _what_ should not be longer than 4096 characters?
### Expected Behavior
Ideally, the error message would:
a) Explain what value is too long (what it represents, where it was found, etc)
b) Perhaps even give the first _n_ characters of said value, for easier pinpointing of the problem
### To Reproduce
Do something which triggers this error message.
-----------------------
For what it's worth, I've tried to find any version I could of this error in both the nextjs and vercel codebases, and have been unable to. The only similar issues/discussions I could find were https://github.com/vercel/vercel/discussions/5940 and https://github.com/vercel/vercel/discussions/4799, but neither one addressed this particular error message. | https://github.com/vercel/next.js/issues/27696 | https://github.com/vercel/next.js/pull/27703 | 79e30f9cb608d1f3088ded80b23787b1a066673f | b3c959b2c295a1a24a0a91770cafd1e9010c7751 | "2021-08-02T16:43:23Z" | javascript | "2021-08-02T22:34:44Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 27,644 | ["packages/next/client/image.tsx", "test/integration/image-component/default/pages/layout-fill-inside-nonrelative.js", "test/integration/image-component/default/pages/layout-responsive-inside-flex.js", "test/integration/image-component/default/test/index.test.js"] | The responsive layout is incompatible with a Flexbox container | ### What version of Next.js are you using?
11.0.1
### What version of Node.js are you using?
14.16.1
### What browser are you using?
Chrome
### What operating system are you using?
Ubuntu 20.04.2 LTS
### How are you deploying your application?
yarn start
### Describe the Bug
Images with the responsive layout are not displayed on the page if put inside a flexbox container.
### Expected Behavior
Responsive images should be visible.
### To Reproduce
0. Create an app through:
```bash
npx create-next-app next-image-flexbox-bug
cd next-image-flexbox-bug
```
1. Create a Next page with the following code:
```javascript
// pages/next-image-flexbox-bug.js
import Image from 'next/image';
export default function NextImageFlexboxBug() {
return (
<div style={{display: 'flex'}}>
<Image
src="/sunset1.jpg"
alt="Sunset"
width={600}
height={450}
layout="responsive"
/>
</div>
)
}
```
2. Run the server:
```bash
yarn dev
```
3. Open in Chrome:
http://localhost:3000/next-image-flexbox-bug
4. Nothing is displayed on the page (the white screen). | https://github.com/vercel/next.js/issues/27644 | https://github.com/vercel/next.js/pull/28221 | 7ea7c23866badff1a571858bc5a4327f0417e47f | ce187563efe1984d381d6021c3f45ab962156620 | "2021-07-31T04:12:34Z" | javascript | "2021-08-18T02:05:10Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 27,593 | ["packages/next/compiled/terser/bundle.min.js", "packages/next/package.json", "yarn.lock"] | Crash in production build (due to minifier miscompiling fast-check code) | ### What version of Next.js are you using?
11.0.1
### What version of Node.js are you using?
16
### What browser are you using?
Chrome
### What operating system are you using?
macOS
### How are you deploying your application?
next build; next start
### Describe the Bug
```javascript
import * as React from 'react'
import * as fc from 'fast-check'
import pr from 'pure-rand'
function Page() {
React.useEffect(() => {
const random = new fc.Random(pr.xoroshiro128plus(0))
console.log(fc.string().generate(random).value)
}, [])
return <div>INDEX</div>
}
export default Page
```
When you do a production build of this, the minifier breaks the fast-check code and causes a crash at runtime. The website works fine in dev mode.

The minifier seems to have troubles with the way how class methods are used in the original ES6 code. I'm using this patch locally to work around the bug:
```diff
diff --git a/node_modules/fast-check/lib/esm/arbitrary/_internals/implementations/SchedulerImplem.js b/node_modules/fast-check/lib/esm/arbitrary/_internals/implementations/SchedulerImplem.js
index f32315a..ccc5525 100644
--- a/node_modules/fast-check/lib/esm/arbitrary/_internals/implementations/SchedulerImplem.js
+++ b/node_modules/fast-check/lib/esm/arbitrary/_internals/implementations/SchedulerImplem.js
@@ -126,7 +126,7 @@ export class SchedulerImplem {
.join('\n') +
'`');
}
- [cloneMethod]() {
+ [cloneMethod] = () => {
return new SchedulerImplem(this.act, this.sourceTaskSelector);
}
}
diff --git a/node_modules/fast-check/lib/esm/arbitrary/context.js b/node_modules/fast-check/lib/esm/arbitrary/context.js
index f4d79aa..cdae00d 100644
--- a/node_modules/fast-check/lib/esm/arbitrary/context.js
+++ b/node_modules/fast-check/lib/esm/arbitrary/context.js
@@ -13,7 +13,7 @@ class ContextImplem {
toString() {
return JSON.stringify({ logs: this.receivedLogs });
}
- [cloneMethod]() {
+ [cloneMethod] = () => {
return new ContextImplem();
}
}
diff --git a/node_modules/fast-check/lib/esm/check/model/commands/CommandsIterable.js b/node_modules/fast-check/lib/esm/check/model/commands/CommandsIterable.js
index 91b2516..715deec 100644
--- a/node_modules/fast-check/lib/esm/check/model/commands/CommandsIterable.js
+++ b/node_modules/fast-check/lib/esm/check/model/commands/CommandsIterable.js
@@ -7,7 +7,7 @@ export class CommandsIterable {
[Symbol.iterator]() {
return this.commands[Symbol.iterator]();
}
- [cloneMethod]() {
+ [cloneMethod] = () => {
return new CommandsIterable(this.commands.map((c) => c.clone()), this.metadataForReplay);
}
toString() {
```
### Expected Behavior
No crash.
### To Reproduce
The page code above is all you need (install all dependencies, build with next build; then next start and open the website).
Repo: https://github.com/wereHamster/next-fast-check-minifier-bug | https://github.com/vercel/next.js/issues/27593 | https://github.com/vercel/next.js/pull/27600 | 77c385af068d315ebad8235834416db195e1c85e | e6d12a9d941fcd6fdcca44434a382cd6e65748c3 | "2021-07-29T09:54:06Z" | javascript | "2021-07-29T18:08:14Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 27,563 | ["packages/next/server/next-server.ts", "packages/next/shared/lib/router/utils/prepare-destination.ts", "test/production/required-server-files-i18n.test.ts"] | Rewrites don't automatically pass path params in query with i18n enabled | When leveraging rewrites in `next.config.js` rewrites are meant to automatically pass params from the `source` in the `destination`'s query unless a param is already used in the destination. This doesn't work correctly when `i18n` is used as well unless `locale: false` is set on the rewrite since we are detecting the internal `locale` path param as a user path param causing the `destination` query to not be updated
Example:
```js
// next.config.js
module.exports = {
i18n: {
defaultLocale: 'en'
locales: ['en', 'fr']
},
rewrites() {
return [
// path should be available in the query for the below rewrite
// but is not when the above i18n config is enabled
{ source: '/old-blog/:post', destination: '/blog/new-location' },
]
}
}
``` | https://github.com/vercel/next.js/issues/27563 | https://github.com/vercel/next.js/pull/31281 | 6abc6699e9f93a7872a4f861f518671beebd9b2f | 6b89fbf12d50f6ed7fc696d5ded48a52af98bca8 | "2021-07-28T15:46:54Z" | javascript | "2021-11-11T20:11:50Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 27,465 | ["docs/basic-features/layouts.md"] | [docs] Add an example how to use persistent layouts with TypeScipt | ### Describe the feature you'd like to request
The current docs on [persistent layouts](https://nextjs.org/docs/basic-features/layouts) are great but lack explanation on how to correctly use it with TypeScript.
There are some examples on the web but they all have their differences and since the original documentation was written to
> [Help clear up customer confusion about how to share React state with layouts, including nested layouts](https://github.com/vercel/next.js/pull/27021#issue-686089248)
I think this is a good addition.
### Describe the solution you'd like
A code example would be more than enough in my opinion.
### Describe alternatives you've considered
I have read up on multiple online sources and I have come up with a solution by combining some of them.
You can imagine that this is not the best way of doing it and it feels out of place since Next.js has very good TypeScript docs otherwise. | https://github.com/vercel/next.js/issues/27465 | https://github.com/vercel/next.js/pull/27488 | dd7a54c5099c781273b01f97788e980fd203e188 | 34d418c12d593c4180f805fc51229259caa5e28a | "2021-07-25T00:07:25Z" | javascript | "2021-07-30T16:30:32Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 27,428 | ["packages/next/server/config-shared.ts"] | `import('next').NextConfig` has required `generateBuildId` property | ### What version of Next.js are you using?
11.0.2-canary.20
### What version of Node.js are you using?
14.17.2
### What browser are you using?
firefox
### What operating system are you using?
ubuntu
### How are you deploying your application?
vercel
### Describe the Bug
in the current canary version, `next` exposes a config type at `import('next').NextConfig`. however, currently this has a required `generateBuildId` property, which should not be there i guess. it also seems to be missing the `eslint` config fields.
### Expected Behavior
the config type at `import('next').NextConfig` should not have required properties (and include all possible configuration options)
### To Reproduce
```js
// next.config.js
/** @type {import('next').NextConfig} */
const config = {
reactStrictMode: true,
};
module.exports = config;
``` | https://github.com/vercel/next.js/issues/27428 | https://github.com/vercel/next.js/pull/27443 | bf02cf84d9714393d57f230576e777c0a5752a54 | a8b9c3a3ed85be63a587e7fd9168b2de04f2f25e | "2021-07-23T06:09:15Z" | javascript | "2021-07-23T17:14:25Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 27,324 | ["packages/next/lib/typescript/writeAppTypeDeclarations.ts", "test/unit/write-app-declarations.test.ts"] | Next 11.0.1 forces wrong line-endings on Windows in next-env.d.ts | ### What version of Next.js are you using?
@latest v11.0.1
### What version of Node.js are you using?
@latest-ish v15.14.0
### What browser are you using?
Chrome
### What operating system are you using?
Windows 10 x64
### How are you deploying your application?
Vercel
### Describe the Bug
Next 11 writes `next-env.d.ts` all the time, but it uses *nix style line endings:


### Expected Behavior
*Don't manually force line-endings to CR
*Respect `.gitattributes` file (explictly specificing CR LF)
*Respect operating-system preference (CR LF on Windows)
### To Reproduce
1. Throw Prettier errors using this configuration:
`prettier.config.js`
```
module.exports = {
// These settings are handled in .editorconfig:
tabWidth: 2, // indent_size = 2
useTabs: false, // indent_style = space
endOfLine: "lf", // end_of_line = lf
semi: false, // default: true
singleQuote: false,
printWidth: 80,
trailingComma: "es5",
bracketSpacing: true,
}
```
`.eslintrc.js`
```
module.exports = {
extends: [
"eslint:recommended",
"plugin:prettier/recommended",
],
rules: {
"prettier/prettier": "error",
},
}
```
### Preferable solution: Ask some of your engineers to switch to Windows full-time | https://github.com/vercel/next.js/issues/27324 | https://github.com/vercel/next.js/pull/28100 | 05a732eb7ae4263ec1f1c1d647f4e581edb0c936 | 23ce41e2bce521b55b9e17e5600dd98e9dfe6955 | "2021-07-20T07:09:23Z" | javascript | "2021-09-20T03:55:46Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 27,298 | ["packages/next/cli/next-dev.ts"] | Hot reload connection can fail on Windows | ### What version of Next.js are you using?
11.0.1
### What version of Node.js are you using?
v14.17.0
### What browser are you using?
Edge 91.0.864.67 - Chrome 91.0.4472.124
### What operating system are you using?
Windows 10 Pro 20H2
### How are you deploying your application?
npm run dev
### Describe the Bug
Hot reload / Fast Refresh isn't working.
I'm following the next tutorial, so here's my code:
npx create-next-app nextjs-blog --use-npm --example "https://github.com/vercel/next-learn-starter/tree/master/learn-starter"
Here https://nextjs.org/learn/basics/create-nextjs-app/editing-the-page it says that the page will live reload, just like react / vue, but it doenst reload.
On network tab I see this errors:

Approaches tried following google/yt tutorials:
Create next.config.js with FAST_REFRESH='TRUE'
Create webpack.config.js with TARGET = 'WEB'
Delete project and restarted from 0
npm ci
Delete node_modules and .next and recreated
### Expected Behavior
Live reload should work.
### To Reproduce
npx create-next-app nextjs-blog --use-npm --example "https://github.com/vercel/next-learn-starter/tree/master/learn-starter" | https://github.com/vercel/next.js/issues/27298 | https://github.com/vercel/next.js/pull/27306 | b123942694ec729c7ebf97b329125385226160db | 1effbae67aca5acca040ad32ffb3bcbe5c2294aa | "2021-07-19T14:12:23Z" | javascript | "2021-07-19T23:12:27Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 27,292 | ["packages/eslint-config-next/core-web-vitals.js", "packages/eslint-plugin-next/lib/index.js", "test/integration/eslint/plugin-core-web-vitals-config/.eslintrc", "test/integration/eslint/plugin-core-web-vitals-config/pages/index.js", "test/integration/eslint/plugin-recommended-config/.eslintrc", "test/integration/eslint/plugin-recommended-config/pages/index.js", "test/integration/eslint/test/index.test.js"] | [eslint] make "core-web-vitals" available as plugin config | ### Describe the feature you'd like to request
currently, the "core-web-vitals" eslint config is part of `eslint-config-next`. since the docs recommend in certain scenarios to extend directly from `eslint-plugin-next`, i think both the `recommended` and the `web-vitals` config should be part of the eslint plugin, so it is possible to `extends: ['plugin:@next/next/recommended', 'plugin:@next/next/core-web-vitals']`
to discuss: if the web-vitals config should include the recommended rule set, or if it should always be used in combination with the recommended config.
### Describe the solution you'd like
something like https://github.com/stefanprobst/next.js/commit/d2dadb13700cde422e8cdd0f7167968643a0c7d7
### Describe alternatives you've considered
keep as is | https://github.com/vercel/next.js/issues/27292 | https://github.com/vercel/next.js/pull/27363 | a8b9c3a3ed85be63a587e7fd9168b2de04f2f25e | daf54bb2b0bbc97f4d774d34bb1b5a2823c3e07e | "2021-07-19T07:21:36Z" | javascript | "2021-07-23T17:58:53Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 27,290 | ["examples/with-mobx-state-tree-typescript/components/SampleComponent.tsx", "examples/with-mobx-state-tree-typescript/next-env.d.ts", "examples/with-mobx-state-tree-typescript/pages/ssg.tsx", "examples/with-mobx-state-tree-typescript/pages/ssr.tsx"] | with-mobx-state-tree-typescript ssr&ssg doesn't work | ### What example does this report relate to?
with-mobx-state-tree-typescript
### What version of Next.js are you using?
11.0.1
### What version of Node.js are you using?
14.15.4
### What browser are you using?
Chrome
### What operating system are you using?
Windows
### How are you deploying your application?
next dev
### Describe the Bug
after 'next dev', and visit 'http://localhost:3000/ssr'
The console report:

### Expected Behavior
Expect SSR and SSG work correctly.
In my env, 'with-mobx-state-tree' can work well.
### To Reproduce
Just checkout 'with-mobx-state-tree-typescript' and run 'npm run dev' | https://github.com/vercel/next.js/issues/27290 | https://github.com/vercel/next.js/pull/27339 | e0ca6de8323e762bbca48b8b14365e3dd6b5e471 | 9fc58f88a2bca1d6ddab861a7bf4b2cf56ddbb92 | "2021-07-19T05:19:40Z" | javascript | "2021-07-20T14:15:02Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 27,254 | ["packages/next/cli/next-dev.ts"] | Fast refresh not working on browser, a very weird case | ### What version of Next.js are you using?
11.0.1
### What version of Node.js are you using?
14.17.3
### What browser are you using?
Chrome, Edge, Firefox
### What operating system are you using?
Windows 10, 11
### How are you deploying your application?
did not deploy
### Describe the Bug
I encountered a very weird case which fast refresh not working on browser, I have done a lot of research and tests but still no luck to find out why it happens.
All the tests below are done on the same bootstrap project with following command
```
yarn create next-app
cd my-app
yarn dev
```
Node version is the same 14.17.3
**Laptop 1 Windows 10 latest build**
When I modify `pages/index.js` (change the "Welcome to..." text) and save the file, the terminal print out a new line says `compiling ...`, but the page on browser not auto refresh at all. Tried on Chrome, Firefox, Edge, all not working.
I was using fnm to as my node manager, but I tried to install node,js binary directly, still not working. I tried use nvm-windows as my node manager, still not working.
Then I think it's maybe fast refresh has some bug, I tried `yarn create react-app`, then run `yarn start`, then do similar modification and save the file. The page on browser refreshed as expected!
**Another Laptop 2 Windows 11 latest preview build** (Windows 11 may not make any difference)
When I modify `pages/index.js` (change the "Welcome to..." text) and save the file, it just works fine!
So only when I use `next.js` on Laptop 1, fast refresh does not working at all, which I have to manual refresh.
The behavior indicates the file change is detected which means webpack watch works fine, but he communication to notify change is broken, that's why the browser doesn't auto refresh the page when there is a new change.
I'm not using WSL, and my shell is Powershell 7 latest version.
### Expected Behavior
Fast refresh would refresh the page whenever a file is changed
### To Reproduce
Mentioned above | https://github.com/vercel/next.js/issues/27254 | https://github.com/vercel/next.js/pull/27306 | b123942694ec729c7ebf97b329125385226160db | 1effbae67aca5acca040ad32ffb3bcbe5c2294aa | "2021-07-17T07:11:02Z" | javascript | "2021-07-19T23:12:27Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 27,252 | ["docs/basic-features/layouts.md"] | Per-page layouts example fails ESLint | ### What version of Next.js are you using?
11.0.1
### What version of Node.js are you using?
16.5.0
### What browser are you using?
Firefox
### What operating system are you using?
Ubuntu 20.04.02
### How are you deploying your application?
next build
### Describe the Bug
When apply the [per-page layouts](https://nextjs.org/docs/basic-features/layouts#per-page-layouts) example to a fresh Next.js project created with `npx create-next-app`, I get this error when running `npm run build`:
```
./pages/index.js
72:18 Error: Component definition is missing display name react/display-name
```
### Expected Behavior
I expect the example code to pass the lints. This could be an issue with the example code or the default lints enabled.
### To Reproduce
Here is a reproducible package: [test-lint-react-display-name.zip](https://github.com/vercel/next.js/files/6833834/test-lint-react-display-name.zip)
Run:
```bash
npm install
npm run build
```
`npm run build` output:
```
% npm run build
> [email protected] build
> next build
info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
Attention: Next.js now collects completely anonymous telemetry regarding usage.
This information is used to shape Next.js' roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://nextjs.org/telemetry
info - Checking validity of types
Failed to compile.
./pages/index.js
72:18 Error: Component definition is missing display name react/display-name
Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
```
Here is the line in question:
```javascript
Home.getLayout = (page) => (
``` | https://github.com/vercel/next.js/issues/27252 | https://github.com/vercel/next.js/pull/27297 | 2b319ccfd931d939def27132836562a4e06740e7 | 187f4312ccbba1533f9d4ce2d26a5d8e8145bae4 | "2021-07-16T23:49:10Z" | javascript | "2021-07-19T19:15:53Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 27,213 | ["docs/api-reference/next/image.md", "packages/next/client/image.tsx", "test/integration/image-component/base-path/public/test.svg", "test/integration/image-component/default/pages/on-loading-complete.js", "test/integration/image-component/default/public/test.svg", "test/integration/image-component/default/test/index.test.js", "test/integration/image-optimizer/app/public/test.svg"] | `onLoadingComplete()` should pass `naturalWidth` and `naturalHeight` | ### What version of Next.js are you using?
11.0.2-canary.16
### What version of Node.js are you using?
14.16.0
### What browser are you using?
Brave (Chromium)
### What operating system are you using?
Windows
### How are you deploying your application?
next dev
### Describe the Bug
onLoadingComplete() event handler does not pass any props.
### Expected Behavior
The expected behavior for onLoadingComplete (unless I'm missing the point of this prop) is the same as onLoad for regular old HTML <img> and onLoadedMetadata/onCanPlay for videos -- a synthetic react event with .target prop.
### To Reproduce
I have a function/event handler that calculates the aspect ratio of an image as soon as it is loaded:
```
const calcAspectRatio = (loadedMedia) => {
console.log("loadedMedia", loadedMedia)
let ratio;
let width;
let height; // ... you get the idea. bug can be replicated with a simple console.log though.
```
Here's how I've implemented next/image:
```
<Image layout="fill" src={media} onLoadingComplete={calcAspectRatio} />
```
and videos:
```
<video muted autoPlay={autoPlay} loop onLoadedMetadata={calcAspectRatio}>
<source src={media} />
</video>
```
Currently the calcAspectRatio **returns `undefined` for next/image - afaiu, this would mean it doesn't pass any reference to itself when loading is complete**
And returns this (expected) for video:
```
SyntheticBaseEvent {_reactName: "onLoadedMetadata", _targetInst: null, type: "loadedmetadata", nativeEvent: Event, target: video.nfte__media-content, …}
```

| https://github.com/vercel/next.js/issues/27213 | https://github.com/vercel/next.js/pull/27695 | b3c959b2c295a1a24a0a91770cafd1e9010c7751 | b05cdb1f6488553abadfb9c6c1707a25e50415bc | "2021-07-15T23:35:50Z" | javascript | "2021-08-02T23:14:38Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 27,208 | ["packages/next/server/image-optimizer.ts", "test/integration/image-optimizer/test/index.test.js"] | Image Optimization should use the stale-while-revalidate pattern | ### Describe the feature you'd like to request
Currently, optimized images are [cached on disk](https://nextjs.org/docs/basic-features/image-optimization#caching) for a period of time indicated by the upstream `Cache-Control` header. This means the first request to the image could be slow but subsequent requests are fast. But when the cache expires, the next request will be slow again.
### Describe the solution you'd like
We can avoid this second slowdown by using the stale-while-revalidate pattern. Once the cache expires, we can serve the cached image anyway and generate the new optimized image in the background.
### Describe alternatives you've considered
We could apply the `stale-while-revalidate` header, but that is still experimental and doesn't work in Safari or IE. Also, Vercel [strips that header](https://vercel.com/docs/edge-network/frequently-asked-questions#is-my-browser-aware-of-stale-while-revalidate-should-i-expect-content-flash-if-yes) so the browser will not see it. | https://github.com/vercel/next.js/issues/27208 | https://github.com/vercel/next.js/pull/33735 | eea3adc53d217523ca2595b6403f832d060ed2d1 | 16b5bfa78ea0bb68e49f7527d0398ee9e6696ead | "2021-07-15T20:31:47Z" | javascript | "2022-01-27T21:33:23Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 27,194 | ["docs/api-reference/next.config.js/redirects.md"] | Error redirects with params | ### Describe the Bug
Problem creating 301 redirects
### Expected Behavior
when creating a redirect it passes the parameters to the destination by default, but the expected result is a url without parameters.
### To Reproduce
Just putting the following code in next.config.js
```javascript
async redirects() {
return [
{
'source': '/lamps.html\\?p=1',
'destination': '/lamps',
'permanent': true
},
]
}
```
The redirect from /lamps.html?p=1 makes it to /lamps?p=1 and the expected result is /lamps | https://github.com/vercel/next.js/issues/27194 | https://github.com/vercel/next.js/pull/27545 | f3fcbef2cb41cf1370e9d3a3111c5c64ac2a4c18 | 1af78928d64a8470f52bed74a1fe30fbad261085 | "2021-07-15T10:31:43Z" | javascript | "2021-07-27T21:34:19Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 27,170 | ["packages/react-dev-overlay/src/internal/components/CodeFrame/CodeFrame.tsx", "packages/react-dev-overlay/src/internal/components/CodeFrame/styles.tsx"] | Error popup file path overflowing if very long | ### What version of Next.js are you using?
11.0.1
### What version of Node.js are you using?
14.17.3
### What browser are you using?
Chrome
### What operating system are you using?
Ubuntu
### How are you deploying your application?
next
### Describe the Bug
The error file path is very long and is overflowing.

### Expected Behavior
For the file path to break onto the new line without overflowing out of the box.
### To Reproduce
Create a deeply nested file and cause an error in it. | https://github.com/vercel/next.js/issues/27170 | https://github.com/vercel/next.js/pull/27575 | ac58857d7d1ec6c14bb24bf84e5d2ebf2122b0e7 | cb3ce2105fa0bee392c3c4643d73b2e8dc1d4032 | "2021-07-14T13:56:23Z" | javascript | "2021-10-28T16:05:09Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 27,163 | ["packages/next/client/image.tsx"] | next/image generates invalid html tag (empty alt attribute) | ### What version of Next.js are you using?
11.0.1
### What version of Node.js are you using?
15.7.0
### What browser are you using?
safari
### What operating system are you using?
macOS
### How are you deploying your application?
other
### Describe the Bug
As I see, `next/image` generates some divs with image inside it. I don't know the exact reason for that, but this additional image has empty `alt` attribute which prevent site from being passed html validator.


### Expected Behavior
To pass validation
### To Reproduce
```javascript
import Image from 'next/image';
<Image
{...rest}
src={(imgSrc as StaticImageData) || fallback}
alt={alt}
unoptimized
className={className}
onError={() => {
setImgSrc(fallback);
}}
/>
`
| https://github.com/vercel/next.js/issues/27163 | https://github.com/vercel/next.js/pull/27767 | 3ab5d600d3bf1c025da652affe04a06628d77790 | 2061d6c4fe02c2f9ac7c9f92eb190308626ba308 | "2021-07-14T09:24:05Z" | javascript | "2021-08-04T18:42:59Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 27,134 | ["errors/manifest.json", "errors/no-duplicate-head.md", "packages/eslint-plugin-next/lib/index.js", "packages/eslint-plugin-next/lib/rules/no-duplicate-head.js", "test/eslint-plugin-next/no-duplicate-head.test.js"] | Double Head component inside _document breaks all onClick browser events and Link | ### What version of Next.js are you using?
11
### What version of Node.js are you using?
12
### What browser are you using?
any browser Chrome or Safari or Firefox
### What operating system are you using?
any
### How are you deploying your application?
dev problem and also on next start or next export
### Describe the Bug
We declared by accident two <Head> components inside the _document.tsx/_document.js.
What happened was that this change broke our Next project both in development and production and we couldn't figure out this issue until we removed randomly this duplicated Head component.
### Effects of this bug
1. all browser events like onClick won't work on any type of element, buttons, links
2. all Next/link will do a full page reload
### Expected Behavior
If declaring two <Head> components inside the _document file create this huge change/bug it should be suggested during the build or local dev execution that only one instance of the Head component can be declared inside the _document file.
A disclaimer into the documentation page could be also a nice addition to make this issue more visibile to prevent other people from losing as much time as we did to find a so tiny and breaking line of code.
### To Reproduce
Declare two <Head> components inside the _document like this code:
```
...
class MyDocument extends Document<Props> {
...
render(): JSX.Element {
return (
<Html lang="it">
<Head>
<meta charSet="utf-8" />
<link
href="https://fonts.googleapis.com/css2?family=Sarabun:ital,wght@0,400;0,700;1,400;1,700&display=swap"
rel="stylesheet"
/>
</Head>
<Head>
<script
dangerouslySetInnerHTML={{
__html: `
`,
}}
/>
</Head>
<body>
<Main />
<NextScript />
</body>
</Html>
);
}
}
export default MyDocument;
``` | https://github.com/vercel/next.js/issues/27134 | https://github.com/vercel/next.js/pull/27179 | d29a95ad633e16fca3c37255d395a243eba3dab6 | c46b405ba7f5520a0cd4c99c8e9dd814bfbe3961 | "2021-07-13T10:12:52Z" | javascript | "2021-07-15T18:04:17Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 27,129 | ["errors/no-cache.md"] | Suggested GitHub Actions caching gets stale | ### What version of Next.js are you using?
latest
### What version of Node.js are you using?
16.0.0
### What browser are you using?
Chrome
### What operating system are you using?
macOS
### How are you deploying your application?
next start in a Docker container
### Describe the Bug
When using GitHub actions, `/.next/cache` is generated once, and then remains stale until you update your npm packages. If you don't update your packages, your cache will never be updated, even as your app grows, new pages are added, etc.
### Expected Behavior
The CI cache should be updated whenever `/.next/cache` is updated.
### To Reproduce
The docs for `no-cache` give the following snippet on how to configure NextJS build caches with GitHub actions:
```yaml
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}
```
Using that is enough to reproduce. More details:
The cache generated by that snippet is keyed on `package-lock.json`. Now, from the GitHub Actions docs:
> When the action finds a cache, the action restores the cached files to the path you configure. If [and only if] there is no exact match, the action creates a new cache entry if the job completes successfully.
https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows
So as long as you are not updating `package-lock.json`, `/.next/cache` will never be updated again. As you keep developing your app, the cache gets more stale. I'm not sure what the consequences for this are on bundle caching, but at a minimum it increases build times significantly (on my app, builds were 30% slower than they should be).
An idea to fix this is to use `restore-keys`:
> The cache action first searches for cache hits for `key` and `restore-keys` in the branch containing the workflow run. If there are no hits in the current branch, the cache action searches for `key` and `restore-keys` in the parent branch and upstream branches.
```yaml
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.[jt]sx?') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
```
With this configuration, an exact cache hit will only happen if files on `**/*.js` didn't change. If any of those files change, we have a cache miss and GitHub will generate a new, updated cache. *However*, GitHub will still restore the most recently generated cache from either the current or parent branch (as long as it was built with the same `package-lock.json`).
Unfortunately, the second hash (`**/*.[jt]sx?`) has to be customized to each use case. However, I think that one will work for 95% of use cases, and for the other ones it'll just cache a bit less than ideal (but still much better than the current suggestion).
A caveat here is that the cache will keep growing over time with stale data, until a package-lock update happens. There's no ideal solution to this until cache prunes are available in NextJS builds. If this is a big problem to anyone, you can add the current week of the year to the cache key, so your cache is regenerated from scratch once a week. In our own repo, we do that at Sunday morning and follow it with a clean build to regenerate the cache while we're all enjoying our extended Sunday sleep. | https://github.com/vercel/next.js/issues/27129 | https://github.com/vercel/next.js/pull/27362 | 52ae69ac33a50ce1051b7d3ef0e74bc49d5e3972 | a3b2205b4214d937b1c3f108bd6548edb3e419d2 | "2021-07-12T22:06:50Z" | javascript | "2021-07-22T03:12:39Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 27,109 | ["packages/next/server/node-polyfill-fetch.js", "test/integration/node-fetch-keep-alive/pages/api/json.js", "test/integration/node-fetch-keep-alive/pages/ssg.js", "test/integration/node-fetch-keep-alive/pages/ssr.js", "test/integration/node-fetch-keep-alive/test/index.test.js"] | Add keepAlive to `fetch` | ### Describe the feature you'd like to request
The current `fetch` polyfill closes the connection after each request but we would like to keep it open.
### Describe the solution you'd like
We could utilize a [keep-alive](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Connection) connection by assigning in a default [Agent](https://nodejs.org/api/http.html#http_class_http_agent) and achieve [similar performance](https://github.com/Ethan-Arrowood/undici-fetch/blob/main/benchmarks.md#fetch) to `undici-fetch`.
### Describe alternatives you've considered
Swap `node-fetch` for `undici-fetch`. | https://github.com/vercel/next.js/issues/27109 | https://github.com/vercel/next.js/pull/27376 | c218347faa9f22ad5c7c45ceb1fd8e6035514c61 | 79ed8e13b0567889782461d8a3f20e48c6d65a4d | "2021-07-12T13:17:43Z" | javascript | "2021-07-22T14:34:33Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 27,094 | ["docs/upgrading.md"] | Since when I have to call .src on imported image? | ### What version of Next.js are you using?
11.0.1
### What version of Node.js are you using?
15.7.0
### What browser are you using?
Safari
### What operating system are you using?
macOS
### How are you deploying your application?
DO
### Describe the Bug
I have a lot of image imports like this
`import heroBg from 'public/images/bg/rent_day_promo.jpg';`
and use it like this:
`<div
className="g-height-100x divimage dzsparallaxer--target w-100 g-bg-cover g-bg-pos-top-center g-bg-img-hero g-bg-bluegray-opacity-0_3--after"
style={{ backgroundImage: `url(${heroBg})`, backgroundSize: 'cover' }}
/>`
But since one of the upgrades I started to receiving 404 errors. After some digging I realized that request looks like `/images/bg/[object object]`. Seems like imported image becomes an object and I need to call `.src` to make it work. I haven't found anything about that in upgrade guide. Am I missed something?
### Expected Behavior
backward compatibility
### To Reproduce
See above | https://github.com/vercel/next.js/issues/27094 | https://github.com/vercel/next.js/pull/27104 | 1c8a7d55c1066ad19558c4b4f9aec54831fe5719 | 5520dd3fd92ee4df9a02ff4139666df4cedc7039 | "2021-07-12T07:14:45Z" | javascript | "2021-07-12T13:16:13Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 27,000 | ["packages/next/server/config-utils.ts"] | jest-worker breaks building the project with "write EPIPE" error on macOS | ### What version of Next.js are you using?
11.0.1
### What version of Node.js are you using?
16.4.2
### What browser are you using?
Firefox
### What operating system are you using?
macOs Big Sur 11.4 (MacBook Pro 15" 2017)
### How are you deploying your application?
next build
### Describe the Bug
I've decided to move my project on to [email protected], using macOS for development.
When i try building it, i get the following lines:
```
info - Loaded env from /Users/brrrrrr/.env
(node:99496) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(Use `node --trace-warnings ...` to show where the warning was created)
info - Checking validity of types
info - Creating an optimized production build .node:events:371
throw er; // Unhandled 'error' event
^
Error: write EPIPE
at ChildProcess.target._send (node:internal/child_process:849:20)
at ChildProcess.target.send (node:internal/child_process:722:19)
at ChildProcessWorker.initialize (/Users/brrrrrr/.yarn/cache/jest-worker-npm-27.0.6-83200713fc-8d7ab8cdf6.zip/node_modules/jest-worker/build/workers/ChildProcessWorker.js:181:11)
at ChildProcessWorker._onExit (/Users/brrrrrr/.yarn/cache/jest-worker-npm-27.0.6-83200713fc-8d7ab8cdf6.zip/node_modules/jest-worker/build/workers/ChildProcessWorker.js:277:12)
at ChildProcess.emit (node:events:394:28)
at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
Emitted 'error' event on ChildProcess instance at:
at node:internal/child_process:853:39
at processTicksAndRejections (node:internal/process/task_queues:78:11) {
errno: -32,
code: 'EPIPE',
syscall: 'write'
}
```
At some point, the error was gone, but i cannot reproduce the steps necessary to completely fix the issue.
This issue is related to macOS and nextjs >11 versions only as this error doesn't pop up on other machines/versions.
Related: This project uses the `pnp` packaging system from `yarn version berry`
### Expected Behavior
The project should build.
### To Reproduce
Calling `next build` on macOS with next@11 | https://github.com/vercel/next.js/issues/27000 | https://github.com/vercel/next.js/pull/28420 | d143d9879f2bbb43809f59059ab08cbe4b8fabf6 | 00f1519ae7ce970dd85556880fb199ff9dcb7b12 | "2021-07-08T00:53:29Z" | javascript | "2021-08-23T17:14:17Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 26,970 | ["examples/with-patternfly/package.json"] | --example with-patternfly needs next-transpile-modules updated | ### What version of Next.js are you using?
latest
### What version of Node.js are you using?
14.17.3
### What browser are you using?
Chrome
### What operating system are you using?
RHEL8
### How are you deploying your application?
next start
### Describe the Bug
`next-transpile-modules` needs to be updated to version `8.0.0`. The current version, `7.3.0` no longer works.
### Expected Behavior
A webpack error occurs when running version `7.3.0`.
### To Reproduce
Run
``` json
npx create-next-app --example with-patternfly with-patternfly-app
# or
yarn create next-app --example with-patternfly with-patternfly-app
```
Then,
``` js
yarn dev
``` | https://github.com/vercel/next.js/issues/26970 | https://github.com/vercel/next.js/pull/26971 | 38a4e56cfa2c5d6708197207bd24ff5c3046bbee | 5b1c3e39e198be1482e27499c85c4ddce79de753 | "2021-07-06T19:39:03Z" | javascript | "2021-07-06T20:14:45Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 26,894 | ["docs/api-reference/next.config.js/ignoring-eslint.md", "docs/basic-features/eslint.md", "packages/eslint-config-next/index.js", "packages/eslint-plugin-next/lib/rules/no-document-import-in-page.js", "packages/eslint-plugin-next/lib/rules/no-head-import-in-document.js", "packages/eslint-plugin-next/lib/rules/no-page-custom-font.js", "test/eslint-plugin-next/no-document-import-in-page.unit.test.js", "test/eslint-plugin-next/no-head-import-in-document.unit.test.js", "test/eslint-plugin-next/no-page-custom-font.unit.test.js"] | Custom fonts not added at the document level will only load for a single page. | ### What version of Next.js are you using?
11.0.1
### What version of Node.js are you using?
16.3.0
### What browser are you using?
Chrome
### What operating system are you using?
macOS
### How are you deploying your application?
next start
### Describe the Bug
I am getting a warning:
> Custom fonts not added at the document level will only load for a single page. This is discouraged. See https://nextjs.org/docs/messages/no-page-custom-font.eslint(@next/next/no-page-custom-font)
When I visit [the link](https://nextjs.org/docs/messages/no-page-custom-font) in the error, it mentions to me that I create a `pages/_document.js` file to paste the following content:
```js
// pages/_document.js
import Document, { Html, Head, Main, NextScript } from 'next/document'
class MyDocument extends Document {
render() {
return (
<Html>
<Head>
<link
href="https://fonts.googleapis.com/css2?family=Inter&display=optional"
rel="stylesheet"
/>
</Head>
<body>
<Main />
<NextScript />
</body>
</Html>
)
}
}
export default MyDocument
```
I am using similar content mentioned on the error page.
```tsx
// pages/_document.tsx
import NextDocument, { Html, Head, Main, NextScript, DocumentContext } from 'next/document'
class MyDocument extends NextDocument {
static async getInitialProps(ctx: DocumentContext) {
const initialProps = await NextDocument.getInitialProps(ctx)
return { ...initialProps }
}
render() {
return (
<Html lang="en">
<Head>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="true" />
<link
href="https://fonts.googleapis.com/css2?family=Lora:wght@700&display=swap"
rel="stylesheet"
/>
</Head>
<body
className="dark:bg-primary dark:text-white"
>
<Main />
<NextScript />
</body>
</Html>
)
}
}
export default MyDocument
```
### Expected Behavior
It shouldn't give a warning in VSCode.
### To Reproduce
Just create a simple Next + TS project & paste the above thing in `_document.tsx` | https://github.com/vercel/next.js/issues/26894 | https://github.com/vercel/next.js/pull/26331 | 0593dbb260ceb1a358122af33f8c3a2eddd8ed99 | df83ccb7cd151452664792e145b8e595ae95a66f | "2021-07-03T12:11:42Z" | javascript | "2021-08-05T00:58:06Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 26,892 | ["packages/next/client/image.tsx", "test/integration/image-component/typescript/components/image-dynamic-src.tsx", "test/integration/image-component/typescript/pages/invalid.tsx", "test/integration/image-component/typescript/pages/valid.tsx", "test/integration/image-component/typescript/test/index.test.js"] | [typescript] Next.js ImageProps giving errors after updating to Next.js v11.0.1 | ### What version of Next.js are you using?
11.0.1
### What version of Node.js are you using?
14.17.0
### What browser are you using?
Firefox, Chrome
### What operating system are you using?
Windows
### How are you deploying your application?
Vercel
### Describe the Bug
I created a component and used `next/image` inside it, also I created a new type based on the `ImageProps` from next/image and used that type for my component props type.
Then the ts compiler gave me the following errors:
```
Type '{ key?: Key | null | undefined; alt?: string | undefined; crossOrigin?: "" | "anonymous" | "use-credentials" | undefined; decoding?: "async" | "auto" | "sync" | undefined; referrerPolicy?: HTMLAttributeReferrerPolicy | undefined; ... 266 more ...; src: string | StaticImport; } | { ...; } | { ...; } | { ...; } | { .....' is not assignable to type 'IntrinsicAttributes & ImageProps'.
Type '{ key?: Key | null | undefined; alt?: string | undefined; crossOrigin?: "" | "anonymous" | "use-credentials" | undefined; decoding?: "async" | "auto" | "sync" | undefined; referrerPolicy?: HTMLAttributeReferrerPolicy | undefined; ... 266 more ...; src: string | StaticImport; }' is not assignable to type 'IntrinsicAttributes & ImageProps'.
Type '{ key?: Key | null | undefined; alt?: string | undefined; crossOrigin?: "" | "anonymous" | "use-credentials" | undefined; decoding?: "async" | "auto" | "sync" | undefined; referrerPolicy?: HTMLAttributeReferrerPolicy | undefined; ... 266 more ...; src: string | StaticImport; }' is not assignable to type 'ObjectImageProps'.
Types of property 'src' are incompatible.
Type 'string | StaticImport' is not assignable to type 'StaticImport'.
Type 'string' is not assignable to type 'StaticImport'.ts(2322)
```
However, it used to work with next.js version 10.2.3.
### Expected Behavior
TS compiler should not give errors.
### To Reproduce
Here's the full code to my component:
```
import NextImage, { ImageProps } from "next/image";
import { useState } from "react";
type FadeImageProps = ImageProps & {
fallbackSrc?: string;
};
const FadeImage = ({
fallbackSrc = "/media/placeholder/350x300.jpg",
src,
...props
}: FadeImageProps) => {
const [ready, setReady] = useState(false);
const [imgSrc, setImgSrc] = useState(false);
const [oldSrc, setOldSrc] = useState(src);
if (oldSrc !== src) {
setImgSrc(false);
setOldSrc(src);
}
return (
<div
style={{
opacity: ready ? 1 : 0,
transition: "opacity .3s ease-in-out",
}}
>
<NextImage
src={imgSrc ? fallbackSrc : src}
onError={() => {
setImgSrc(true);
}}
onLoad={(event) => {
event.persist();
event.currentTarget.srcset && setReady(true);
}}
{...props}
/>
</div>
);
};
export default FadeImage;
``` | https://github.com/vercel/next.js/issues/26892 | https://github.com/vercel/next.js/pull/26996 | 12aa56123b1aff9fa1c1f4499bc800b77fb1bad4 | b6c590bce1242e5ad81a01759c6e630f4c9f6881 | "2021-07-03T07:18:44Z" | javascript | "2021-07-07T21:31:30Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 26,860 | ["docs/basic-features/script.md", "packages/next/client/script.tsx", "test/integration/script-loader/pages/index.js", "test/integration/script-loader/pages/page5.js", "test/integration/script-loader/test/index.test.js"] | next/script in _app.js creates duplicate script tags in document after moving between pages | ### What version of Next.js are you using?
11.0.1
### What version of Node.js are you using?
16.1.0
### What browser are you using?
Chrome, Safari
### What operating system are you using?
macOS
### How are you deploying your application?
next export
### Describe the Bug
When I add inline script tags to `_app.js` they are then added to the document and ran multiple times when navigating between pages.
This is causing problems with GTM as it's throwing errors that it has already been registered.
### Expected Behavior
There should only be one script tag in the document per `next/script` and it should run once instead of every time navigation occurs.
### To Reproduce
https://github.com/williamtetlow/nextjs-multiple-script-tags
1. Start app
2. Click link through to page
3. Click link back to index
4. See in console that scripts using `next/script` are ran multiple times
5. See in HTML there are duplicate script tags with same content
<img width="531" alt="Screenshot 2021-07-02 at 10 08 47" src="https://user-images.githubusercontent.com/9057181/124251192-8d888100-db1d-11eb-926e-fdc5966e2601.png">
<img width="547" alt="Screenshot 2021-07-02 at 10 07 15" src="https://user-images.githubusercontent.com/9057181/124251104-7184df80-db1d-11eb-92b4-f896fe6c49db.png">
| https://github.com/vercel/next.js/issues/26860 | https://github.com/vercel/next.js/pull/27218 | 6645248d4112b8b8d8481dc094f114efcd4e30b2 | dda23f5d9b4928f47434153d835c92297986c106 | "2021-07-02T09:09:36Z" | javascript | "2021-07-16T18:58:34Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 26,795 | ["docs/api-reference/next.config.js/rewrites.md"] | Rewrites in beforeFiles result in 404 errors when a afterFiles also contains a matching rewrite. | ### What version of Next.js are you using?
11.0.1
### What version of Node.js are you using?
16.0.0
### What browser are you using?
Chrome
### What operating system are you using?
Windows, MacOS
### How are you deploying your application?
next start
### Describe the Bug
If `beforeFiles` and `afterFiles` are both supplied, and a route could match both, rewrites will result in 404 pages instead of rewriting to the correct page.
Removing the `afterFiles` rewrite causes the `beforeFiles` rewrites to work again (at the expense of losing that functionality).
This occurs in latest, and started with `10.2.3-canary.1`.
### Expected Behavior
`beforeFiles` rewrites continue to work as expected when they match, and are not affected by `afterFiles`.
### To Reproduce
https://github.com/threehams/static-site-feature-flags/tree/before-files-after | https://github.com/vercel/next.js/issues/26795 | https://github.com/vercel/next.js/pull/27211 | 057d338db438ae97ebae776dd46eb04520ac9e60 | 6e99f7af39d5a31bab8c227e945bd3e765b3d3fe | "2021-07-01T05:45:12Z" | javascript | "2021-07-16T16:13:40Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 26,737 | ["packages/next/server/image-optimizer.ts", "test/integration/image-optimizer/test/index.test.js"] | Image filename/title is not dynamic when using Next/Image and external URLs | ### What version of Next.js are you using?
10.2.0
### What version of Node.js are you using?
14.15.5
### What browser are you using?
Chrome/Brave
### What operating system are you using?
macOS
### How are you deploying your application?
Vercel, next start
### Describe the Bug
When attempting to right-click download an image using Next/Image that is hosted outside of the static folder (i.e. a CMS), the title of the image is set to `image` for all images.
### Expected Behavior
Images should right-click download with the name of the image, like locally hosted static images do.
### To Reproduce
1. create a new image using Next/Image
2. use an externally hosted image src
3. right-click download, the save as filename/title will read `image` | https://github.com/vercel/next.js/issues/26737 | https://github.com/vercel/next.js/pull/27521 | 1af78928d64a8470f52bed74a1fe30fbad261085 | 36b81f989c01bf8bbf823de8d2677d98b82390fe | "2021-06-29T21:11:30Z" | javascript | "2021-07-27T23:22:48Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 26,713 | ["examples/with-redux-toolkit-typescript/next-env.d.ts", "examples/with-redux-toolkit-typescript/package.json"] | Older Version of TypeScript Detected | ### What example does this report relate to?
with-redux-toolkit-typescript
### What version of Next.js are you using?
latest
### What version of Node.js are you using?
latest
### What browser are you using?
Chrome
### What operating system are you using?
Windows
### How are you deploying your application?
vercel
### Describe the Bug

The older version of typescript is detected. Might be incompatible with newer versions of next later down the line.
### Expected Behavior
No warning should be shown.
### To Reproduce
To reproduce:
1. `npm i`
2. `npm run dev`
3. See the warning
| https://github.com/vercel/next.js/issues/26713 | https://github.com/vercel/next.js/pull/26714 | 15afd9772983ed4a0ec52e7eaa25e75b15d081c8 | 46a85b4e6f48c35d785a113434f038b7879313be | "2021-06-29T06:31:35Z" | javascript | "2021-06-29T14:52:03Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 26,618 | ["packages/next/pages/_document.tsx"] | Using strategy="beforeInteractive" with the new next/script Script component triggers: Warning: Each child in a list should have a unique "key" prop. | ### What version of Next.js are you using?
11.0.1
### What version of Node.js are you using?
12.18.2
### What browser are you using?
Firefox
### What operating system are you using?
MacOS Big Sur 11.04
### How are you deploying your application?
npm run dev
### Describe the Bug
When using the new `next/script` `<Script />` component to load scripts, it will trigger the following warning in the dev server console when loading the page in the browser for the first time:
```bash
➜ npm run dev
> [email protected] dev /Users/xenostar/Git/nextjs-blog
> next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
event - compiled successfully
event - build page: /
wait - compiling...
event - compiled successfully
Warning: Each child in a list should have a unique "key" prop. See https://reactjs.org/link/warning-keys for more information.
at script
at Head (webpack-internal:///./node_modules/next/dist/pages/_document.js:252:5)
at html
at Html (webpack-internal:///./node_modules/next/dist/pages/_document.js:241:29)
at Document (webpack-internal:///./node_modules/next/dist/pages/_document.js:198:1)
```
It _seems_ that `strategy="beforeInteractive"` may be the culprit, as removing that will remove the warning. This warning will be triggered even if there is only one script called using `strategy="beforeInteractive"`.
### Expected Behavior
There should be no warning when using `strategy="beforeInteractive"` with a `<Script />` component.
### To Reproduce
Using the finished [nextjs-blog demo](https://nextjs.org/learn/basics/create-nextjs-app/setup) from the official docs will allow you to reproduce the behavior.
To reproduce, modify the finished demo `_app.js` file like so by adding new `<Script />` tags:
```jsx
import Script from "next/script";
import "../styles/global.css";
export default function App({ Component, pageProps }) {
return (
<>
<Script src="https://js.stripe.com/v3/" strategy="beforeInteractive" />
<Script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.13.1/underscore-min.js" />
<Script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js" />
<Component {...pageProps} />
</>
);
}
```
I've used CDN scripts so anyone can reproduce.
Using the new `next/script` `<Script />` components to load scripts with `strategy="beforeInteractive"` with at least one of the scripts will trigger the following Warning in the dev server console when loading the page in the browser for the first time:
```bash
➜ npm run dev
> [email protected] dev /Users/xenostar/Git/nextjs-blog
> next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
event - compiled successfully
event - build page: /
wait - compiling...
event - compiled successfully
Warning: Each child in a list should have a unique "key" prop. See https://reactjs.org/link/warning-keys for more information.
at script
at Head (webpack-internal:///./node_modules/next/dist/pages/_document.js:252:5)
at html
at Html (webpack-internal:///./node_modules/next/dist/pages/_document.js:241:29)
at Document (webpack-internal:///./node_modules/next/dist/pages/_document.js:198:1)
```
Removing the `strategy="beforeInteractive"` will get rid of the warning when the page renders.
This warning is also observable when building the app, as there is a warning for each page:
```bash
➜ npm run build
> [email protected] build /Users/xenostar/Git/nextjs-blog
> next build
info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
info - Checking validity of types
warn - No ESLint configuration detected. Run next lint to begin setup
info - Creating an optimized production build
info - Compiled successfully
info - Collecting page data
[ ===] info - Generating static pages (0/6)Warning: Each child in a list should have a unique "key" prop. See https://reactjs.org/link/warning-keys for more information.
at script
at Head (/Users/xenostar/Git/nextjs-blog/.next/server/pages/_document.js:549:5)
at html
at Html (/Users/xenostar/Git/nextjs-blog/.next/server/pages/_document.js:538:29)
at Document (/Users/xenostar/Git/nextjs-blog/.next/server/pages/_document.js:495:1)
[ ==] info - Generating static pages (1/6)Warning: Each child in a list should have a unique "key" prop. See https://reactjs.org/link/warning-keys for more information.
at script
at Head (/Users/xenostar/Git/nextjs-blog/.next/server/pages/_document.js:549:5)
at html
at Html (/Users/xenostar/Git/nextjs-blog/.next/server/pages/_document.js:538:29)
at Document (/Users/xenostar/Git/nextjs-blog/.next/server/pages/_document.js:495:1)
Warning: Each child in a list should have a unique "key" prop. See https://reactjs.org/link/warning-keys for more information.
at script
at Head (/Users/xenostar/Git/nextjs-blog/.next/server/pages/_document.js:549:5)
at html
at Html (/Users/xenostar/Git/nextjs-blog/.next/server/pages/_document.js:538:29)
at Document (/Users/xenostar/Git/nextjs-blog/.next/server/pages/_document.js:495:1)
[ ==] info - Generating static pages (2/6)Warning: Each child in a list should have a unique "key" prop. See https://reactjs.org/link/warning-keys for more information.
at script
at Head (/Users/xenostar/Git/nextjs-blog/.next/server/pages/_document.js:549:5)
at html
at Html (/Users/xenostar/Git/nextjs-blog/.next/server/pages/_document.js:538:29)
at Document (/Users/xenostar/Git/nextjs-blog/.next/server/pages/_document.js:495:1)
postData {
id: 'pre-rendering',
contentHtml: '<p>Next.js has two forms of pre-rendering: <strong>Static Generation</strong> and <strong>Server-side Rendering</strong>. The difference is in <strong>when</strong> it generates the HTML for a page.</p>\n' +
'<ul>\n' +
'<li><strong>Static Generation</strong> is the pre-rendering method that generates the HTML at <strong>build time</strong>. The pre-rendered HTML is then <em>reused</em> on each request.</li>\n' +
'<li><strong>Server-side Rendering</strong> is the pre-rendering method that generates the HTML on <strong>each request</strong>.</li>\n' +
'</ul>\n' +
'<p>Importantly, Next.js lets you <strong>choose</strong> which pre-rendering form to use for each page. You can create a "hybrid" Next.js app by using Static Generation for most pages and using Server-side Rendering for others.</p>\n',
title: 'Two Forms of Pre-rendering',
date: '2020-01-01'
}
Warning: Each child in a list should have a unique "key" prop. See https://reactjs.org/link/warning-keys for more information.
at script
at Head (/Users/xenostar/Git/nextjs-blog/.next/server/pages/_document.js:549:5)
at html
at Html (/Users/xenostar/Git/nextjs-blog/.next/server/pages/_document.js:538:29)
at Document (/Users/xenostar/Git/nextjs-blog/.next/server/pages/_document.js:495:1)
postData {
id: 'ssg-ssr',
contentHtml: '<p>We recommend using <strong>Static Generation</strong> (with and without data) whenever possible because your page can be built once and served by CDN, which makes it much faster than having a server render the page on every request.</p>\n' +
'<p>You can use Static Generation for many types of pages, including:</p>\n' +
'<ul>\n' +
'<li>Marketing pages</li>\n' +
'<li>Blog posts</li>\n' +
'<li>E-commerce product listings</li>\n' +
'<li>Help and documentation</li>\n' +
'</ul>\n' +
`<p>You should ask yourself: "Can I pre-render this page <strong>ahead</strong> of a user's request?" If the answer is yes, then you should choose Static Generation.</p>\n` +
"<p>On the other hand, Static Generation is <strong>not</strong> a good idea if you cannot pre-render a page ahead of a user's request. Maybe your page shows frequently updated data, and the page content changes on every request.</p>\n" +
'<p>In that case, you can use <strong>Server-Side Rendering</strong>. It will be slower, but the pre-rendered page will always be up-to-date. Or you can skip pre-rendering and use client-side JavaScript to populate data.</p>\n',
title: 'When to Use Static Generation v.s. Server-side Rendering',
date: '2020-01-02'
}
Warning: Each child in a list should have a unique "key" prop. See https://reactjs.org/link/warning-keys for more information.
at script
at Head (/Users/xenostar/Git/nextjs-blog/.next/server/pages/_document.js:549:5)
at html
at Html (/Users/xenostar/Git/nextjs-blog/.next/server/pages/_document.js:538:29)
at Document (/Users/xenostar/Git/nextjs-blog/.next/server/pages/_document.js:495:1)
info - Generating static pages (6/6)
info - Finalizing page optimization
Page Size First Load JS
┌ ● / 1.5 kB 78.1 kB
├ /_app 0 B 63.7 kB
├ ○ /404 278 B 64 kB
├ λ /api/hello 0 B 63.7 kB
├ ● /posts/[id] 1.34 kB 77.9 kB
├ ├ /posts/pre-rendering
├ └ /posts/ssg-ssr
└ ○ /posts/first-post 1.16 kB 70.8 kB
+ First Load JS shared by all 63.7 kB
├ chunks/framework.c5113a.js 42 kB
├ chunks/main.a3a79a.js 20.2 kB
├ chunks/pages/_app.6bb013.js 721 B
├ chunks/webpack.61095c.js 810 B
└ css/cc846a79cae462a6667f.css 267 B
λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
○ (Static) automatically rendered as static HTML (uses no initial props)
● (SSG) automatically generated as static HTML + JSON (uses getStaticProps)
(ISR) incremental static regeneration (uses revalidate in getStaticProps)
```
**Things I've Tried / Notes**
- Adding a `key` or `data-key` prop to each `<Script />` component doesn't seem to resolve the warning.
- Removing `strategy="beforeInteractive"` from a `<Script />` seems to be the culprit of the warning.
- The warning appears even if there is a single `<Script />` with `strategy="beforeInteractive"` | https://github.com/vercel/next.js/issues/26618 | https://github.com/vercel/next.js/pull/26646 | 538095c93640ad7b1f2eba54610295c70b202d30 | 3b592e206e0129056409c903946528e20a1fc896 | "2021-06-25T22:22:05Z" | javascript | "2021-07-02T20:23:11Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 26,607 | ["packages/next/build/webpack-config.ts", "packages/next/build/webpack/loaders/next-image-loader.js", "test/integration/image-component/default/pages/static-img.js", "test/integration/image-component/default/test/index.test.js", "test/integration/image-component/default/test/static.test.js"] | Static Image Imports Places Duplicate Images In .next\server\chunks Folder | ### What version of Next.js are you using?
11.0.1
### What version of Node.js are you using?
v14.15.4
### What browser are you using?
Brave
### What operating system are you using?
Windows 10
### How are you deploying your application?
Vercel
### Describe the Bug
When using static image imports on pages that are rendered using Server or SSG, for images that are located in the components directory, the image assets are placed in two locations:
* Server: `.next\server\chunks\static\image\components\...`
* Static: `.next\static\image\components\...`
For sites with lots of image imports on pages that are SSG or Server rendered, this can result in `.next/server/chunks` getting very large and for platforms like `Vercel`, builds will fail as the chunks director is greater then 50MB Compressed or 250MB Uncompressed.
### Expected Behavior
Image assets should only be placed in the static folder as `next/image` does not reference images in the server location.
### To Reproduce
- Create a Next.JS Project
- Create a component in the `./components` folder
- Add an image in that same folder
- In the newly created component, add `next/image` component and reference the image you just added
- build the project
Example Component
```
import * as React from "react";
import NextImage from "next/image";
import quarry from "./quarry.png";
export type DuplicatorProps = {
id: string;
};
const Duplicator: React.FC<DuplicatorProps> = (props) => {
return (
<div>
<h1>Hello {props.id}</h1>
<NextImage src={quarry} width={100} height={100} />
</div>
);
};
export default Duplicator;
```
Folder Structure of Components & Image Assets:

Example Output
Static Location

Server Location

| https://github.com/vercel/next.js/issues/26607 | https://github.com/vercel/next.js/pull/26843 | 9039afe75bbde13666424a3c167cd0c34773070d | 277061943a5a537e0bc1c85731b6a872cc31d375 | "2021-06-25T13:13:51Z" | javascript | "2021-07-02T11:27:32Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 26,587 | ["packages/next/server/next-server.ts", "test/integration/image-component/default/pages/static.js", "test/integration/image-component/default/test/static.test.js"] | next/image serves unoptimized local image with max-age=0 | ### What version of Next.js are you using?
11.0.1
### What version of Node.js are you using?
14.17.1
### What browser are you using?
Chrome, Safari
### What operating system are you using?
macOS
### How are you deploying your application?
next start
### Describe the Bug
Next/image serves local images with max-age=0 when using "unoptimized" flag.
```
import image2 from "../public/image2.png";
...
<Image src={image2} width={730} height={300} layout="fixed" unoptimized />
```
This image is served with `Cache-Control: public, max-age=0` header, which forces browsers to revalidate the image every time they load a page.
In comparison an optimized image is served with `Cache-Control: public, max-age=315360000, immutable` header.
### Expected Behavior
Cache-control header for "unoptimized" images should be no different from the optimized ones since image content is hashed and the image is assigned a unique name.
### To Reproduce
Here is the code sandbox demonstrating this issue - https://codesandbox.io/s/nextjs-unoptimized-image-0svlt | https://github.com/vercel/next.js/issues/26587 | https://github.com/vercel/next.js/pull/26836 | 0562cc77bc1ce7b7149d05cbfade30ff1aacafd5 | 03b61778ba468093e1eb54b5b30023d2beab47d5 | "2021-06-24T22:49:39Z" | javascript | "2021-07-01T22:14:42Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 26,533 | ["docs/basic-features/typescript.md"] | `next-env.d.ts` is regenerated on each build | ### What version of Next.js are you using?
`11.0.1`
### What version of Node.js are you using?
`14.7.0`
### What operating system are you using?
`Windows 10 (21390.1)`
### How are you running your application?
`next build && next start`
### Describe the Bug
The content of `next-env.d.ts` is being replaced by the following code each time I run `next build` or simply `next`:
```ts
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />
```
### Expected Behavior
Changes in `next-env.d.ts` should be respected. Quoting docs (emphasis mine):
> A file named `next-env.d.ts` will be created in the root of your project. This file ensures Next.js types are picked up by the TypeScript compiler. You cannot remove it, however, **_you can edit it_** (but you don't need to).
### To Reproduce
```sh
yarn create next-app --ts test-app
cd test-app
echo "// just a comment to show" >> next-env.d.ts
cat next-env.d.ts
yarn build
cat next-env.d.ts
``` | https://github.com/vercel/next.js/issues/26533 | https://github.com/vercel/next.js/pull/26536 | cb95c59ad5a4f8b308126e54a37f2f659ede4389 | 1dd9c4b8d9118fbe0ef497a22e051d180f798e5e | "2021-06-23T15:28:26Z" | javascript | "2021-06-23T16:20:28Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 26,531 | ["packages/next/client/image.tsx", "test/integration/image-component/typescript/components/image-card.tsx", "test/integration/image-component/typescript/pages/invalid.tsx", "test/integration/image-component/typescript/pages/valid.tsx", "test/integration/image-component/typescript/test/index.test.js"] | ImageProps type are not assignable to next/image | ### What version of Next.js are you using?
11.0.0
### What version of Node.js are you using?
16.0.0
### What browser are you using?
Firefox
### What operating system are you using?
Arch Linux
### How are you deploying your application?
Vercel
### Describe the Bug
I made an Image component with `chakra-ui` Box as a wrapper for `next/image`. When I try to assign the props type, it gives me a TypeScript type error:
> Type '{ objectFit: "cover"; layout: "fill"; src: string | StaticImport; alt: string | undefined; }' is not assignable to type 'IntrinsicAttributes & ImageProps'.
`@chakra-ui/react` version: 1.6.3
### Expected Behavior
No type error.
### To Reproduce
Here's the component:
```ts
import { Box, BoxProps } from '@chakra-ui/react'
import NextImage, { ImageProps } from 'next/image'
export type NextChakraImageProps = Omit<BoxProps, 'as'> & ImageProps
export function NextChakraImage({ src, alt, ...rest }: NextChakraImageProps) {
return (
<Box {...rest}>
<NextImage objectFit="cover" layout="fill" src={src} alt={alt} />
</Box>
)
}
``` | https://github.com/vercel/next.js/issues/26531 | https://github.com/vercel/next.js/pull/26991 | 8066e423a7c51e8c670e8328beac91e80da2fc0a | 23a47b9f87c12331a1a8362d2fdce0e1d449ba94 | "2021-06-23T15:18:34Z" | javascript | "2021-07-07T19:15:31Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 26,508 | ["packages/next/shared/lib/router/router.ts", "test/integration/dynamic-routing/pages/index.js", "test/integration/dynamic-routing/test/index.test.js"] | Router loses query params after push() with a dynamic route | ### What version of Next.js are you using?
11.0.1
### What version of Node.js are you using?
14.17.0
### What browser are you using?
Chrome
### What operating system are you using?
macOS
### How are you deploying your application?
Local build
### Describe the Bug
I think I have found a router regression. When calling `router.push` with a dynamic route, any query string values are lost on the new route if the asPath value doesn't have those query string values. This was working in `10.1.3` and i think it broke around `10.2.x`. Something like:
```
router.push({
pathname: "/something/new",
query: {param: "value"}},
"/something/new")
```
where there is a `[catchall]/new.js` page. See the reproduction repo below.
### Expected Behavior
Query parameters should be accessible with dynamic routes when asPath doesn't contain the query params
### To Reproduce
Clone and run https://github.com/alecrae/nextjs-router-query-missing
Go to the index page and then on load it will execute a `router.push` to a new page, the query params is missing. Downgrade the next version to `10.1.3` and it will work | https://github.com/vercel/next.js/issues/26508 | https://github.com/vercel/next.js/pull/29246 | 8e52126ea6e01f1cf6fd61b136dda35ba97de827 | 50c75282cd151a5c2861f5360fbfaa71fe0fe64c | "2021-06-23T02:29:43Z" | javascript | "2021-09-21T14:21:27Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 26,507 | ["examples/with-google-tag-manager/components/GoogleTagManager.js", "examples/with-google-tag-manager/pages/_app.js", "examples/with-google-tag-manager/pages/_document.js"] | [with-google-analytics] Should Use next/script component | ### What example does this report relate to?
with-google-analytics
### What version of Next.js are you using?
11
### What version of Node.js are you using?
14
### What browser are you using?
chrome
### What operating system are you using?
mac
### How are you deploying your application?
Vercel
### Describe the Bug
The Script Component is not used in this example. Google Analytics is used very often and is mentioned in [the Script Component documentation](https://nextjs.org/docs/basic-features/script). This example should be updated.
### Expected Behavior
Use Script Component.
### To Reproduce
None. | https://github.com/vercel/next.js/issues/26507 | https://github.com/vercel/next.js/pull/29061 | ce870babb749f49b440c10ac6a27f21cebcd4c14 | 01d3539b0443b72fb7175be07d3c1b611d050f91 | "2021-06-23T00:16:55Z" | javascript | "2021-09-13T17:43:35Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 26,337 | ["examples/with-tailwindcss-emotion/package.json", "examples/with-tailwindcss-emotion/tailwind.config.js"] | TypeError: Cannot read property 'theme' of undefined | ### What example does this report relate to?
with-tailwindcss-emotion
### What version of Next.js are you using?
11 | 10.2.3
### What version of Node.js are you using?
14.17.1
### What browser are you using?
Chrome & Firefox
### What operating system are you using?
Win 10
### How are you deploying your application?
n/a
### Describe the Bug
Running "npm run dev" results in `TypeError: Cannot read property 'theme' of undefined`
### Expected Behavior
Running "npm run dev" starts up the application without errors
### To Reproduce
Following the instructions, I ran `npx create-next-app --example with-tailwindcss-emotion with-tailwindcss-emotion-app`, then `npm run dev`, then see error.
**EDIT:** Might relate to [#25854](https://github.com/vercel/next.js/issues/25854) and [#26012](https://github.com/vercel/next.js/pull/26012). The only tailwindcss version that works while disabling `mode: "jit"` is tailwindcss 2.1.4 (thanks for the [pull request](https://github.com/vercel/next.js/pull/26012), @akellbl4 )
If this is considered a duplicate, please close/delete | https://github.com/vercel/next.js/issues/26337 | https://github.com/vercel/next.js/pull/35588 | 3c001aaae957b13983ade32fb0ed0bcb13426980 | 53eb04679031e7476d917cbaff2a4c8a4d51e243 | "2021-06-18T18:42:40Z" | javascript | "2022-05-22T04:42:51Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 26,319 | ["docs/api-reference/next.config.js/ignoring-eslint.md", "docs/basic-features/eslint.md", "packages/eslint-config-next/index.js", "packages/eslint-plugin-next/lib/rules/no-document-import-in-page.js", "packages/eslint-plugin-next/lib/rules/no-head-import-in-document.js", "packages/eslint-plugin-next/lib/rules/no-page-custom-font.js", "test/eslint-plugin-next/no-document-import-in-page.unit.test.js", "test/eslint-plugin-next/no-head-import-in-document.unit.test.js", "test/eslint-plugin-next/no-page-custom-font.unit.test.js"] | eslint-config-next fetch is not defined | ### What version of Next.js are you using?
11.0.0
### What version of Node.js are you using?
16.2.0
### What browser are you using?
n/a
### What operating system are you using?
windows 10
### How are you deploying your application?
n/a
### Describe the Bug
if .eslintrc file contais :`{
"extends": ["eslint:recommended","next"]
}`
and I run npm run lint
I get error that 'fetch' is not defined

### Expected Behavior
no warning error or do I need to disabe this rule or do I need to add this to .eslintrc:
`{
"extends": ["eslint:recommended", "next"],
"env": {"browser": true}
}`
### To Reproduce
npx create-next-app --example data-fetch data-fetch-app
cd data-fetch-app
add `"scripts": {
"lint": "next lint"
}
`to package.json
npm install --save-dev eslint eslint-config-next
npm run lint
change .eslintrc to
`{
"extends": ["eslint:recommended", "next"]
}`
npm run lint
| https://github.com/vercel/next.js/issues/26319 | https://github.com/vercel/next.js/pull/26331 | 0593dbb260ceb1a358122af33f8c3a2eddd8ed99 | df83ccb7cd151452664792e145b8e595ae95a66f | "2021-06-18T14:32:14Z" | javascript | "2021-08-05T00:58:06Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 26,309 | ["packages/next/client/image.tsx", "test/integration/image-component/default/pages/blurry-placeholder.js", "test/integration/image-component/default/pages/static.js", "test/integration/image-component/default/test/index.test.js", "test/integration/image-component/default/test/static.test.js"] | Blurred image not positioned correctly when using object-position | ### What version of Next.js are you using?
11.0.0
### What version of Node.js are you using?
14.13.1
### What browser are you using?
Chrome
### What operating system are you using?
macOS
### How are you deploying your application?
Vercel
### Describe the Bug
Blurred images are not respecting the objectPosition property in Image component
Full image: [Example Image](https://i.schoen.world/cVAqU.png)
**What I see:**

### Expected Behavior
The blurred placeholder should have the save position as the the later loaded full image.
**What I expect:**

An easy fix for this would be to mirror the `object-position` value to the `background-position` value while loading.
### To Reproduce
Setup:
```jsx
import Image from 'next/image'
import exampleImg from '../data/example.png'
const Page = () => (
<Image
src={exampleImg}
width={1024}
height={700}
layout="responsive"
objectFit="cover"
objectPosition="center"
placeholder="blur"
/>
)
export default Page
```
Deployed example: [schoenwaldnils.vercel.app/objectPositionIssue](https://schoen-world-8793xnvzh-schoenwaldnils.vercel.app/objectPositionIssue) | https://github.com/vercel/next.js/issues/26309 | https://github.com/vercel/next.js/pull/26590 | 2373320fc859af3424a8ab7e211b8292e3aafa67 | 551b6149ce9992035e5b79fca5c8054ad820a05e | "2021-06-18T13:07:39Z" | javascript | "2021-06-30T21:58:26Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 26,288 | ["packages/next/client/image.tsx", "test/integration/image-component/basic/pages/client-side.js", "test/integration/image-component/basic/pages/index.js", "test/integration/image-component/basic/test/index.test.js"] | next/image imagix breaks querystrings | ### What version of Next.js are you using?
11
### What version of Node.js are you using?
14
### What browser are you using?
Firefox, Chrome, Edge
### What operating system are you using?
Windows 10
### How are you deploying your application?
Vercel
### Describe the Bug
If the image URL already has a querystring, next/image just appends its own on the end with a ? which breaks both querystrings.
### Expected Behavior
next/image should merge the two querystrings giving some means for the developer to decide which querystring takes priority if both contain the same parameter.
### To Reproduce
Use next/image with imageix/prismic with a image URL that already contains a querystring. | https://github.com/vercel/next.js/issues/26288 | https://github.com/vercel/next.js/pull/26719 | f7bc8f4b7c0b3609dbc65e2941a6cf088b0b4c97 | 38a4e56cfa2c5d6708197207bd24ff5c3046bbee | "2021-06-17T22:17:46Z" | javascript | "2021-07-06T19:51:50Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 26,187 | ["docs/basic-features/script.md"] | next/script not loading anything at all | ### What version of Next.js are you using?
11
### What version of Node.js are you using?
15
### What browser are you using?
Brave
### What operating system are you using?
macOS
### How are you deploying your application?
next dev, next build, serverless
### Describe the Bug
Using the new `next/script` tag inside `document.tsx`
```tsx
<Script
id="gmaps-script"
src="https://maps.googleapis.com/maps/api/js?libraries=places&key=[KEY]&map_ids=[MAP_ID]"
strategy="afterInteractive"
/>
```
The script is not being loaded
### Expected Behavior
The script should load google maps
### To Reproduce
Create a new project via `create-nextjs-app` and add the snippet above.
| https://github.com/vercel/next.js/issues/26187 | https://github.com/vercel/next.js/pull/26253 | 4f3674cc37b1e3bc19ecf4f4e606543f2ce03d8b | 72743bcea87b97186aeb4c870212b800b7469a07 | "2021-06-16T13:09:42Z" | javascript | "2021-06-17T13:46:55Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 26,158 | ["docs/basic-features/script.md"] | next/script causing runtime error TypeError: Cannot read property 'tagName' of null | ### What version of Next.js are you using?
11
### What version of Node.js are you using?
14.17.1
### What browser are you using?
Chrome Version 91.0.4472.77
### What operating system are you using?
macOS Version 11.3
### How are you deploying your application?
next start
### Describe the Bug
Using the new next/script introduced in next 11 instead of <script /> tag causing Uncaught (in promise) TypeError: Cannot read property 'tagName' of null
### Expected Behavior
Should load the script successfully without runtime error
### To Reproduce
```javascript
import Head from "next/head";
import Script from 'next/script';
const Meta = ({
title,
keywords,
description
}) => {
return (
<Head>
<Script src="/example.min.js" strategy="beforeInteractive" /> // <-- causing Uncaught (in promise) TypeError: Cannot read property 'tagName' of null
</Head>
)
}
export default Meta;
```
<img width="969" alt="Screenshot 2021-06-16 at 11 26 20 AM" src="https://user-images.githubusercontent.com/37536299/122153490-b3632400-ce95-11eb-8272-5dfbdd308738.png">
| https://github.com/vercel/next.js/issues/26158 | https://github.com/vercel/next.js/pull/26253 | 4f3674cc37b1e3bc19ecf4f4e606543f2ce03d8b | 72743bcea87b97186aeb4c870212b800b7469a07 | "2021-06-16T03:29:31Z" | javascript | "2021-06-17T13:46:55Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 26,135 | ["packages/next/client/image.tsx", "test/integration/image-component/default/pages/invalid-placeholder-blur.js", "test/integration/image-component/default/pages/invalid-width-or-height.js", "test/integration/image-component/default/test/index.test.js"] | Wrong message that Image with src "/test.jpg" is smaller than 40x40. Consider removing the "placeholder='blur'" property to improve performance. | ### What version of Next.js are you using?
11
### What version of Node.js are you using?
15.12.0
### What browser are you using?
Chrome, Safari
### What operating system are you using?
macOS
### How are you deploying your application?
yarn dev
### Describe the Bug
Terminal says `Image with src "/test.jpg" is smaller than 40x40. Consider removing the "placeholder='blur'" property to improve performance.`
but `test.jpg` is 14669 × 5000. file is below.
https://commons.wikimedia.org/w/index.php?title=Category:Large_images#/media/File:'Matijevic_Hill'_Panorama_for_Rover's_Ninth_Anniversary_(Stereo).jpg
### Expected Behavior
No message with that.
### To Reproduce
put that image in public folder and use below code.
```
<Image
src='/test.jpg'
width='fill'
height='fill'
layout='responsive'
placeholder='blur'
blurDataURL='/test.jpg'
/>
``` | https://github.com/vercel/next.js/issues/26135 | https://github.com/vercel/next.js/pull/26166 | 8a76cad98fc2369bc6aff14e7d17d2858a3a8c7a | 51022d5819c382831a65f963dcf4e69f46072bc9 | "2021-06-15T17:34:20Z" | javascript | "2021-06-17T20:17:31Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 26,090 | ["packages/next/lib/file-exists.ts", "test/integration/custom-routes/test/index.test.js", "test/integration/dynamic-routing/pages/dash/[hello-world].js", "test/integration/dynamic-routing/test/index.test.js", "test/integration/production/pages/invalid-param/[slug].js"] | Character limit in dynamic routes | ### What version of Next.js are you using?
10.2.4-canary
### What version of Node.js are you using?
12.22.1
### What browser are you using?
Chrome
### What operating system are you using?
macOS
### How are you deploying your application?
next start
### Describe the Bug
When using dynamic routes, there seems to be a rather arbitrary limit of 251 characters. If the slug exceeds this length, I get an error page with a 400 error code. This doesn't seem to be documented anywhere.
### Expected Behavior
Dynamic routes should not have any specific character limit, or at least the limit should be documented.
### To Reproduce
Apparently affects any dynamic route. Here is a minimal reproduction:
https://codesandbox.io/s/ecstatic-thunder-ee35x?file=/pages/test/%5Bslug%5D.jsx
[This route](https://ee35x.sse.codesandbox.io/test/qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq) (251 chars) succeeds, while [this one](https://ee35x.sse.codesandbox.io/test/qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq) (252 chars) fails.
*Note:* I wonder if this is related to https://github.com/vercel/next.js/issues/25481 | https://github.com/vercel/next.js/issues/26090 | https://github.com/vercel/next.js/pull/26221 | 67aba8469e16a1d8581153a15decc7fb0b8737cc | 598b1ef11b63cfe1efee23b09a5b14e887e97e07 | "2021-06-14T18:19:44Z" | javascript | "2021-06-17T08:59:46Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 25,927 | ["packages/next/server/render.tsx"] | optimizeCss and assetPrefix config options cannot be used together | ### What version of Next.js are you using?
10.2.3
### What version of Node.js are you using?
14.15.3
### What browser are you using?
Firefox
### What operating system are you using?
Ubuntu
### How are you deploying your application?
other
### Describe the Bug
When I set the `assetPrefix` and the `optimizeCss` experimental feature together, `critters` package cannot locale the local stylesheets.
This is occurring during the static pages generation step.
```
[== ] info - Generating static pages (0/3)
Unable to locate stylesheet: <hidden-path>/.next/https:/cdn.test.com/_next/static/css/01db3197b29cb52779ce.css
Time 10.936099
Unable to locate stylesheet: <hidden-path>/.next/https:/cdn.test.com/_next/static/css/01db3197b29cb52779ce.css
Time 11.778584
Unable to locate stylesheet: <hidden-path>/.next/https:/cdn.test.com/_next/static/css/01db3197b29cb52779ce.css
Unable to locate stylesheet: <hidden-path>/.next/https:/cdn.test.com/_next/static/css/ea6f1f42cebc7b8cbe53.css
Time 14.709094
info - Generating static pages (3/3)
```
### Expected Behavior
`critters` package should be able to find the local stylesheets and parse them.
### To Reproduce
I created a repo to reproduce the issue: https://github.com/noreiller/next-optimizecss-assetprefix.
Otherwise, the steps are:
```sh
yarn create next-app next-optimizecss-assetprefix
cd next-optimizecss-assetprefix
yarn add critters
touch next.config.js
```
Put this config in the next.config.js file:
```js
module.exports = {
assetPrefix: "https://cdn.test.com/",
experimental: {
optimizeCss: true,
},
};
```
And run the build:
```sh
yarn build
```
| https://github.com/vercel/next.js/issues/25927 | https://github.com/vercel/next.js/pull/27506 | 23ac4351f41f13afc17ceb7ca89aacbce5f13e4d | 97a140f7339d8dc99539f89d3a888de8f007390c | "2021-06-09T09:57:31Z" | javascript | "2021-07-26T21:00:47Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 25,790 | ["packages/next/next-server/server/next-server.ts", "test/integration/i18n-support/test/shared.js"] | Next.js i18n routing generates api routes for each locale in Vercel | ### What version of Next.js are you using?
10.2.0
### What version of Node.js are you using?
v14.17.0
### What browser are you using?
firefox / chrome
### What operating system are you using?
macOS
### How are you deploying your application?
Vercel
### Describe the Bug
When using internationalization config, Next.js api route serverless function are generated by Vercel with locale prefixes.
For example, if you have three locales in your `next.config.js` of 'en', 'fr', and 'de', a single api route `/api/hello` will generate:
- `en/api/hello`
- `fr/api/hello`
- `de/api/hello`
This causes issues calling api routes in more complicated applications.
### Expected Behavior
No matter what your localization configurations are, your api routes will deploy with exactly the paths you define.
Does not make sense for api routes to be localized.
### To Reproduce
This boilerplate was created with `create-next-app`: https://github.com/sharad-s/next-i18n
This repo has 3 commits on it.
Deploy the first or second commit to vercel, and you will see an api route function of just `/api/hello`:

Once you deploy the third commit, which only makes a change to `next.config.js`, you will see three localized serverless functions for your single api route:


| https://github.com/vercel/next.js/issues/25790 | https://github.com/vercel/next.js/pull/26629 | c5751fa6c37741302fd7e3f7bcebe88c8aef9b16 | 5b2c845e57ca3ba156901f8669465ea9761e0293 | "2021-06-04T18:51:27Z" | javascript | "2021-06-28T13:56:40Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 25,675 | ["packages/next/client/route-loader.ts"] | Error: Route did not complete loading: /some-page | ### What version of Next.js are you using?
10.2.3
### What version of Node.js are you using?
12.16.1
### What browser are you using?
Chrome
### What operating system are you using?
macOS
### How are you deploying your application?
custom-server-express
### Describe the Bug
While running the dev server, when I click through a couple of `pages/`, linked by the `<Link>` component, a full page load happens very often and randomly. This has been reported before: https://github.com/vercel/next.js/issues/21543, but in connection with debugging with DevTools.
It works as expected on a production build.
### Expected Behavior
Client-side navigation to work without full page loads, except for expected situations, which Fast Refresh warns about and are listed here: https://nextjs.org/docs/basic-features/fast-refresh#how-it-works.
### To Reproduce
Unfortunately, this is very hard to reproduce (meaning create a reproduction). I still can't pinpoint the cause of this behaviour. However, you can add this event listener to your `_app.js` after mount, preserve log in DevTools console, and look for this error right before the full page load.
```js
Router.events.on('routeChangeError', (...yaaarghz) => {
console.log(...yaaarghz)
})
```
(optional) You can also add this debugger statement to look through the callstack.
```js
window.addEventListener('beforeunload', () => {
debugger
})
``` | https://github.com/vercel/next.js/issues/25675 | https://github.com/vercel/next.js/pull/25749 | 36d00a74b6cf80cc8ea7ebc7fad27cff49ada987 | 849a79fbc2cdc346be8e5df1a6c3e5107598b514 | "2021-06-01T10:44:55Z" | javascript | "2021-07-12T16:26:58Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 25,574 | ["packages/next/export/worker.ts", "test/integration/i18n-support/test/index.test.js"] | Default static 500.html pages have incorrect content when using i18n locales | ### What version of Next.js are you using?
10.2.3
### What version of Node.js are you using?
14.17.0
### What browser are you using?
N/A
### What operating system are you using?
MacOS Big Sur
### How are you deploying your application?
next build / next start
### Describe the Bug
When using locales, the default static `500.html` page generated has content for a 404 page, so it doesn't look like it is generating correctly. It seems when generating the locale-specific static error pages, the `500` status is not being passed correctly into the error page here (https://github.com/vercel/next.js/blob/v10.2.3/packages/next/pages/_error.tsx#L22), so it is using 404 status code by default. Probably a small fix, but I haven't had a chance to dig into the Next.js code for this part yet.
A workaround: add your own custom `500.tsx` page.
However, when locales are removed, the default `500.html` static page is generated as expected (with 500: Internal Server Error in the content).
### Expected Behavior
The default locale-specific `500` page should have content like `500: Internal Server Error` instead of `404: This page could not be found`.
### To Reproduce
Follow the steps below or use the provided test repo:
1. Add a simple page e.g `index.tsx`, but do not add any custom error pages like `500.tsx` or `404.tsx`
2. Add locales to your `next.config.js` as such:
```js
module.exports = {
i18n: {
locales: ["en", "fr"],
defaultLocale: "en"
}
}
```
3. Run `next build`.
4. In the build directory it generates some default static error pages for each locale (`en` and `fr` in this case) such as `.next/server/pages/en/500.html`, but it is wrong as the content is for a 404 page. Contents are as follows (truncated here):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width" />
<meta charSet="utf-8" />
<title>404: This page could not be found</title>
<meta name="next-head-count" content="3" />
<noscript data-n-css=""></noscript>
<link rel="preload" href="/_next/static/chunks/webpack-d5db87d7d1dc530a31f5.js" as="script" />
<link rel="preload" href="/_next/static/chunks/framework-56721e7fe9e004cd9e49.js" as="script" />
<link rel="preload" href="/_next/static/chunks/main-14cf201055ab4a0fd452.js" as="script" />
<link rel="preload" href="/_next/static/chunks/pages/_app-587c4eea10d2e7aac138.js" as="script" />
<link rel="preload" href="/_next/static/chunks/pages/_error-d799e3a96772416696b7.js" as="script" />
</head>
...
```
Test repo: https://github.com/dphang/nextjs-repros/tree/locales-wrong-default-500-static-page. (just do a `yarn install && next build` and check the `.next/server/pages/<locale>/500.html` page which has the content for a 404 status code. | https://github.com/vercel/next.js/issues/25574 | https://github.com/vercel/next.js/pull/29250 | d5b1d595c5f8961a7baadea41ee38c313f39f206 | b4d8aa8c48e8a69bf1210daa99c8216318461d4c | "2021-05-29T05:28:38Z" | javascript | "2021-09-21T14:23:23Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 25,490 | ["packages/next/next-server/lib/router/router.ts", "test/integration/build-output/test/index.test.js", "test/integration/custom-routes/pages/multi-rewrites.js", "test/integration/custom-routes/pages/nav.js", "test/integration/custom-routes/test/index.test.js"] | Back button for rewritten page broken in last version | ### What version of Next.js are you using?
10.2.3
### What version of Node.js are you using?
14
### What browser are you using?
Chrome
### What operating system are you using?
macOS
### How are you deploying your application?
none
### Describe the Bug
Pressing the back-button to a rewritten page causes this bug for us in the latest version:
<img width="714" alt="Screen Shot 2021-05-26 at 10 34 29 AM" src="https://user-images.githubusercontent.com/2052659/119679640-867b9e00-be0e-11eb-92da-79f20ce72139.png">
Seems like `shouldResolveHref`, which was added in https://github.com/vercel/next.js/pull/25112 is now `false` and the router is not able to resolve the `href` anymore.
### Expected Behavior
Back button to work.
### To Reproduce
Have a page that is served through a rewrite, go to another page through a next/link transition (only reproducible on the second transition when the page has not been built yet and you're testing it locally), go back to the previous page with the browser back button will throw this error. | https://github.com/vercel/next.js/issues/25490 | https://github.com/vercel/next.js/pull/25666 | d5c2fe616c2493b59bd544b5621c91b7afbac39b | 5476827f193ad8412625a0b63c32523f397146a4 | "2021-05-26T14:41:14Z" | javascript | "2021-06-01T18:01:23Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 25,484 | ["packages/next/build/webpack-config.ts", "packages/next/build/webpack/plugins/nextjs-ssr-import.ts"] | `next dev` fails with webpack error when importing functions inside web worker | ### What version of Next.js are you using?
10.2.3
### What version of Node.js are you using?
16.2.0
### What browser are you using?
Firefox
### What operating system are you using?
macOS
### How are you deploying your application?
next dev
### Describe the Bug
Using a web worker, similar to the [with-web-worker](https://github.com/vercel/next.js/tree/canary/examples/with-web-worker) example. The web worker file (located under `worker/search.js`) imports functions from another local file like this:
```js
import { getIndexRange, getTextItemWithNeighbors } from '../lib/search';
```
Which then results in the following error with Next.js >=10.2.1:
```
error - webpack/runtime/compat
The "path" argument must be of type string. Received undefined
```
I'm able to resolve this error by in-lining the functions directly in the web worker file (`worker/search.js`) instead of importing them.
This issue appeared with [v10.2.1-canary.9](https://github.com/vercel/next.js/releases/tag/v10.2.1-canary.9), so probably introduced by https://github.com/vercel/next.js/pull/25035. It used to work before.
### Expected Behavior
I would like to be able to import the functions in the web worker file without an error, as it used to work in the past.
### To Reproduce
Honestly, it's pretty hard to reproduce this issue... I've tried to apply a similar structure as in my project to the [with-web-worker](https://github.com/vercel/next.js/tree/canary/examples/with-web-worker) example, but wasn't able to reproduce it.
Maybe @nemanja-tosic (https://github.com/vercel/next.js/issues/25276#issuecomment-847681082) has some clues about it... | https://github.com/vercel/next.js/issues/25484 | https://github.com/vercel/next.js/pull/34087 | 40329a70a5b4680e71c5ee1d9a7e59b10d80f113 | 451dfa14f145d0499f39d932eddad39f66328f54 | "2021-05-26T08:31:31Z" | javascript | "2022-02-08T15:20:00Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 25,481 | ["packages/next/lib/file-exists.ts", "test/integration/custom-routes/test/index.test.js", "test/integration/dynamic-routing/pages/dash/[hello-world].js", "test/integration/dynamic-routing/test/index.test.js", "test/integration/production/pages/invalid-param/[slug].js"] | Rewrites fail when the URL is too long | ### What version of Next.js are you using?
10.2.3
### What version of Node.js are you using?
14.16.0
### What browser are you using?
Chrome
### What operating system are you using?
macOS
### How are you deploying your application?
next export
### Describe the Bug
While in development I am trying to use `rewrites` to proxy a local API server. The rewriting works flawlessly until the length of the URL reaches a certain length- in my case, 990 characters.
### Expected Behavior
I'd expect the length of the URL to not impact when a rewrite occurs. Or at least, I'd expect the limit to be large enough to not interfere with reasonable URLs. In my case, I have URLs which need to include certain lengthy tokens (which I do not have control over). If this is intentional, it might be nice to print a warning while in development.
### To Reproduce
I was able to reproduce in a [fresh project](https://github.com/sandgraham/next-rewrites-length) (`create-next-app`) by adding a `next.config.js` like so:
```js
module.exports = {
async rewrites() {
return [
{
source: "/:foo*",
destination: "https://www.google.com/:foo*", // Can be any URL
},
];
},
};
```
Start the dev server and navigate to this URL, which is 256 characters:
```
http://localhost:3000/abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz
```
This should correctly direct you to google (albeit they don't have a page at this URL).
Now navigate to this URL, which is 282 characters:
```
http://localhost:3000/abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz
```
You should instead see a Next.js bad page error. So far as I can tell there is no "rewrite" happening (though I found this kind of difficult to debug).
Note - when creating a reproduction, the length of the URL which caused this issue was different (much shorter) than when I originally ran into the issue (using only localhost). Not sure what that's about... | https://github.com/vercel/next.js/issues/25481 | https://github.com/vercel/next.js/pull/26221 | 67aba8469e16a1d8581153a15decc7fb0b8737cc | 598b1ef11b63cfe1efee23b09a5b14e887e97e07 | "2021-05-26T07:26:16Z" | javascript | "2021-06-17T08:59:46Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 25,441 | ["packages/next/build/webpack-config.ts", "test/integration/build-output/test/index.test.js", "test/integration/production/test/index.test.js"] | [IE11+Webpack5] Automatic publicpath is not supported in this browser | ### What version of Next.js are you using?
10.2.3
### What version of Node.js are you using?
14.15.1
### What browser are you using?
Internet Explorer 11
### What operating system are you using?
Windows
### How are you deploying your application?
Other platform
### Describe the Bug
After upgrading to Webpack 5 I get the error:
"Automatic publicpath is not supported in this browser"
I have a custom webpack configuration and that might be the cause, but the same issue could be reproduced by loading the next.js website (eg. [here](https://nextjs.org/docs/getting-started)).
When creating a fresh project the error is not thrown.
### Expected Behavior
The error "Automatic publicPath is not supported in this browser" should not be thrown.
### To Reproduce
Load the [getting started](https://nextjs.org/docs/getting-started) page of the Next.js docs with IE11 and you should get the error. | https://github.com/vercel/next.js/issues/25441 | https://github.com/vercel/next.js/pull/25452 | b92420772665c808e01f4a76a17cfc9f2fabf711 | d84e2f58e799d9c909f44a200ac79b87cb0abedc | "2021-05-25T11:27:24Z" | javascript | "2021-05-29T12:15:26Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 25,440 | ["packages/next/client/image.tsx", "test/integration/image-component/typescript/components/image-card.tsx", "test/integration/image-component/typescript/pages/invalid.tsx", "test/integration/image-component/typescript/pages/valid.tsx", "test/integration/image-component/typescript/test/index.test.js"] | Type '"fill"' is not assignable to type '"fixed" | "intrinsic" | "responsive" | undefined'. | ### What version of Next.js are you using?
10.2.3
### What version of Node.js are you using?
16.1.0
### What browser are you using?
Chrome
### What operating system are you using?
macOS
### How are you deploying your application?
next start
### Describe the Bug
I am using a simple `next/image` component:
```js
import Image, { ImageProps } from 'next/image'
export const Img = ({ className = '', ...props }: ImageProps) => (
<div className="unset-img full-bleed">
<Image className={`${className} custom-img`} layout="fill" {...props} />
</div>
)
```
I get red-squiggly lines on `layout` saying:
> Type '"fill"' is not assignable to type '"fixed" | "intrinsic" | "responsive" | undefined'.
### Expected Behavior
It shouldn't show a TS error.
### To Reproduce
Clone [this commit](https://github.com/deadcoder0904/better-code-blocks/commit/057fcce49fbdab9620840d775273c152745faede), install the dependencies & run the app. VSCode should yell.
The error is in [this file](https://github.com/deadcoder0904/better-code-blocks/blob/057fcce49fbdab9620840d775273c152745faede/src/components/mdx/Img.tsx). See `layout="fill` there. | https://github.com/vercel/next.js/issues/25440 | https://github.com/vercel/next.js/pull/26991 | 8066e423a7c51e8c670e8328beac91e80da2fc0a | 23a47b9f87c12331a1a8362d2fdce0e1d449ba94 | "2021-05-25T10:28:11Z" | javascript | "2021-07-07T19:15:31Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 25,431 | ["packages/next/build/webpack/plugins/next-trace-entrypoints-plugin.ts", "test/integration/build-trace-extra-entries/content/hello.json", "test/integration/build-trace-extra-entries/lib/get-data.js", "test/integration/build-trace-extra-entries/next.config.js", "test/integration/build-trace-extra-entries/pages/index.js", "test/integration/build-trace-extra-entries/test/index.test.js"] | Webpack 5, API functions and Vercel error | ### What version of Next.js are you using?
10.2.2
### What version of Node.js are you using?
14
### What browser are you using?
Chrome
### What operating system are you using?
macOS
### How are you deploying your application?
Vercel
### Describe the Bug
**What is happening?**
As soon as we enable webpack5, some of our endpoints break.
**Which endpoints?**
Those that share using a function that uses `fs.readFile`. If it's a single endpoint using that function, it works just fine. As soon as we add a second endpoint, they both break.
**What's the error?**
<img width="1082" alt="Screen Shot 2021-05-22 at 12 00 20 AM" src="https://user-images.githubusercontent.com/5664/119417708-d5211f00-bccc-11eb-909d-b10d2c83c92a.png">
**Where does this happen>?**
This **only happens on Vercel**, it works fine locally while doing `next build && next start`.
### Expected Behavior
We should be able to enable webpack5 and not have endpoints breaking under the description listed above.
### To Reproduce
Check it out [this repo](https://github.com/marbiano/next-webpack5-fs-bug). [Here are the two endpoints](https://github.com/marbiano/next-webpack5-fs-bug/tree/main/pages/api) sharing a single external function.
Also, we have Vercel deployments to verify:
- [Here's a deployment](https://next-webpack5-fs-bug-5xryadaxf.cosy.dev/api/hello) with a single endpoint where everything works just fine.
- [Here's a deployment](https://next-webpack5-fs-bug-6z42ka0re.cosy.dev/api/hello) with an extra endpoint where they break.
- [Here's the diff](https://github.com/marbiano/next-webpack5-fs-bug/commit/59c39cc49c72ce6161eead868340a628f2c5c0f2) between those two deployments, in order to fully verify the issue. | https://github.com/vercel/next.js/issues/25431 | https://github.com/vercel/next.js/pull/28667 | c1dbc1260922276f62d010e7bccc3ec2c3ccf627 | 9a6542ba683b7ee4bd566af0dca06bb6b72835a7 | "2021-05-24T23:16:30Z" | javascript | "2021-09-01T15:56:04Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 25,353 | ["packages/next/client/link.tsx", "packages/next/next-server/lib/router/router.ts", "test/integration/dynamic-routing/pages/[name]/index.js", "test/integration/dynamic-routing/test/index.test.js"] | Router path query regression in next 10.2.2 | ### What version of Next.js are you using?
10.2.2
### What version of Node.js are you using?
14.16.1
### What browser are you using?
Chrome
### What operating system are you using?
macOS
### How are you deploying your application?
vercel, next dev
### Describe the Bug
When updating router query using 10.2.0 the url changes correctly (doesn't get duplicated productId)
10.2.0
https://codesandbox.io/s/routerquery-1020-w4t1r?file=/pages/product/%5BproductId%5D.js
10.2.2
https://codesandbox.io/s/routerquery-1022-qlywt?file=/pages/product/%5BproductId%5D.js
### Expected Behavior
When using dynamic routes, updating query using `router.replace({ query: { ...router.query, productId: uuid() } })` should change the path like in 10.2.0
### To Reproduce
10.2.0
https://codesandbox.io/s/routerquery-1020-w4t1r?file=/pages/product/%5BproductId%5D.js
10.2.2
https://codesandbox.io/s/routerquery-1022-qlywt?file=/pages/product/%5BproductId%5D.js
Open both sandboxes, click the "Change productId" button, and you will see:
10.2.0: path stays correct with only one productId in path:
https://w4t1r.sse.codesandbox.io/product/0a61dff3-e58a-47f3-b38a-1915e4cc8247
10.2.2: query gets polluted with extra productId, doesn't match with dynamic route
https://qlywt.sse.codesandbox.io/product/8d4950a5-f6ca-4649-b5bb-debaf4618e22?productId=98b76b78-7bb7-49c8-b974-20ebd21dcc33
### More info
I think this broke in https://github.com/vercel/next.js/pull/24199
Both 10.2.1, 10.2.1-canary.2 and 10.2.2 does not work as expected | https://github.com/vercel/next.js/issues/25353 | https://github.com/vercel/next.js/pull/25469 | d836ebb2487cd2e8f4c60ba2c987017cc8a51827 | 8a06780481dfbb12112a2f1a4ee1d7efca603bc1 | "2021-05-22T10:56:34Z" | javascript | "2021-05-28T12:51:41Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 25,303 | ["packages/next/build/webpack-config.ts", "test/integration/getserversideprops/pages/index.js"] | Imported next-server modules are duplicated, causing duplicate react contexts | ### What version of Next.js are you using?
10.2.1
### What version of Node.js are you using?
16.1.0
### What browser are you using?
Chrome and Safari
### What operating system are you using?
macOS
### How are you deploying your application?
None
### Describe the Bug
We use `@apollo/client` to execute some graphQL queries during SSR: we do this in getServerSideProps, and most importantly by rendering the component tree before nextjs actually renders it on the server. A simplified example of how this looks is below:
```typescript
export function getServerSideProps(ctx) {
// ....
await renderToStringWithData(
<RouterContext.Provider value={router}>
<ApolloProvider client={apolloClient}>
<Page {...props} />
</ApolloProvider>
</RouterContext.Provider >
)
// ...
}
```
Most importantly, because we use `useRouter` and render different components based on `query`, we create a dummy next router and pass it into the router provider:
```typescript
const router = {
query: ctx.query
}
```
The router context itself is imported like so:
```typescript
import { RouterContext } from 'next/dist/next-server/lib/router-context'
```
This worked fine up until 10.2.1, where now calls on the server to `useRouter` return `null`.
After doing some debugging it turns out this is caused by the two different `router-context` modules being imported: One in our app, and one in `next/router`.
So whenever `useRouter` calls `useContext`, it looks up a different `RouterContext` than the `RouterContext` we imported, and thus returns null.
Previously in 10.2.0 these imported modules were the same, and we believe the PR that caused this new behaviour is https://github.com/vercel/next.js/pull/24603
The difference between the generated webpack imports is that on 10.2.0, they look like this:
```javascript
/* harmony import */ var next_dist_next_server_lib_router_context__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! next/dist/next-server/lib/router-context */ "next/dist/next-server/lib/router-context");
```
But on 10.2.1 it now becomes:
```javascript
/* harmony import */
var next_dist_next_server_lib_router_context__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! next/dist/next-server/lib/router-context */
"./node_modules/next/dist/next-server/lib/router-context.js");
```
`./node_modules` has been prefixed
`next/dist/client/router.js` imports the module as `require("../next-server/lib/router-context")`, so understandably webpack gives back two different modules, with two different contexts
### Expected Behavior
Importing modules from `next/dist/next-server/` should resolve to the same module as the modules used by next itself
### To Reproduce
https://github.com/bubba/next-webpack-import-bug.git | https://github.com/vercel/next.js/issues/25303 | https://github.com/vercel/next.js/pull/25518 | 39181c40737f0337849cc58ca73060d13a268f17 | 5e92ae018364f1d9005344c4934719aa3d7ab366 | "2021-05-20T14:22:04Z" | javascript | "2021-05-28T11:17:08Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 25,285 | ["packages/next/next-server/lib/router/router.ts", "test/integration/basepath/test/index.test.js"] | router.back() not working when going back between two dynamic routes | ### What version of Next.js are you using?
10.2.2
### What version of Node.js are you using?
14.15
### What browser are you using?
Chrome
### What operating system are you using?
macOS
### How are you deploying your application?
vercel
### Describe the Bug
I have a dynamic route in the following format:
/path/[type]
If i visit the following paths:
/path/custom1
/path/custom2
and then call router.back() from custom2 I get the following error message:
```log
Unhandled Runtime Error
Error: The provided `as` value (/path/custom1) is incompatible with the `href` value (/h/[type]). Read more: https://nextjs.org/docs/messages/incompatible-href-as
Call Stack
Router._callee$
node_modules/next/dist/next-server/lib/router/router.js (1055:16)
tryCatch
node_modules/regenerator-runtime/runtime.js (63:14)
Generator.invoke [as _invoke]
node_modules/regenerator-runtime/runtime.js (293:0)
Generator.eval [as next]
node_modules/regenerator-runtime/runtime.js (118:0)
asyncGeneratorStep
node_modules/@babel/runtime/helpers/asyncToGenerator.js (3:0)
_next
node_modules/@babel/runtime/helpers/asyncToGenerator.js (25:0)
```
I use my app with a basepath. It is happening only when I have a basepath. My next.config.js file is:
```js
module.exports = {
basePath: "/app",
future: {
webpack5: true
}
};
```
Given my application has lots of dynamic routes I'm unable to upgrade from 10.0 to 10.2.
### Expected Behavior
The page should be able to go back from /path/custom2 to /path/custom1
### To Reproduce
I have created a codesandbox with reproducable scenario:
https://znkfe.sse.codesandbox.io/app
If the buttons are followed, it will land on the issue.
Source: https://codesandbox.io/s/nextjs-routing-issue-znkfe?file=/pages/index.js | https://github.com/vercel/next.js/issues/25285 | https://github.com/vercel/next.js/pull/25459 | 3b9221ff10f1d14672596e5df4407bf8dc4a7cd7 | 08dce4bdc6332ed4a4de69147cb9c7bcaaed6468 | "2021-05-20T07:20:00Z" | javascript | "2021-05-26T07:58:05Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 25,070 | ["packages/next/build/webpack/plugins/font-stylesheet-gathering-plugin.ts", "test/integration/font-optimization/test/index.test.js"] | Font optimization doesn't work on some builds | ### What version of Next.js are you using?
10.2
### What version of Node.js are you using?
14.16.1
### What browser are you using?
Chrome
### What operating system are you using?
macOS
### How are you deploying your application?
next start
### Describe the Bug
Font optimization does not seem to work on some builds
Reported here - https://dev.to/ekafyi/first-impressions-on-next-js-automatic-font-optimization-32a1
### Expected Behavior
Font optimization should work on each build
### To Reproduce
Hard to reproduce, but running consecutive builds on the font-optimization test suite generates this error | https://github.com/vercel/next.js/issues/25070 | https://github.com/vercel/next.js/pull/25071 | b9b35d406cd95e1cfeff03e7e5e4640db39eb300 | de42719619ae69fbd88e445100f15701f6e1e100 | "2021-05-12T21:39:36Z" | javascript | "2021-05-19T10:05:12Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 25,056 | ["data.sqlite", "package.json", "packages/next/data.sqlite", "packages/next/export/index.ts", "test/integration/prerender-native-module/data.sqlite", "test/integration/prerender-native-module/pages/blog/[slug].js", "test/integration/prerender-native-module/pages/index.js", "test/integration/prerender-native-module/test/index.test.js", "test/lib/next-test-utils.js", "yarn.lock"] | Next.js builds and runs locally, but fails in Vercel production with FATAL ERROR: v8::HandleScope::CreateHandle() | ### What version of Next.js are you using?
10.2.0
### What version of Node.js are you using?
14.0.5
### What browser are you using?
Version 90.0.4430.93 (Official Build)
### What operating system are you using?
Windows 10 Home Windows Feature Experience Pack 120.2212.551.0
### How are you deploying your application?
Vercel
### Describe the Bug
Everything works fine in development, APIs move information back and forth and so on. It even deployed without major incident to Vercel when I was on 9.4. Once I upgraded to Next 10 I started receiving this error during build:
<html>
<body>
<!--StartFragment-->
11:01:03.623 | info - Collecting page data...
-- | --
11:01:04.839 | info - Generating static pages (0/3)
11:01:05.622 | FATAL ERROR: v8::HandleScope::CreateHandle() Cannot create a handle without a HandleScope
11:01:05.623 | 1: 0xa04200 node::Abort() [node]
11:01:05.623 | 2: 0x94e4e9 node::FatalError(char const*, char const*) [node]
11:01:05.624 | 3: 0xb794aa v8::Utils::ReportApiFailure(char const*, char const*) [node]
11:01:05.625 | 4: 0xcf6882 v8::internal::HandleScope::Extend(v8::internal::Isolate*) [node]
11:01:05.625 | 5: 0xee668c v8::internal::JSReceiver::GetCreationContext() [node]
11:01:05.625 | 6: 0xb8ae48 v8::Object::CreationContext() [node]
11:01:05.626 | 7: 0x96b4af node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*, node::async_context) [node]
11:01:05.626 | 8: 0x7fa57b8b3e96 node_sqlite3::Database::Work_AfterOpen(uv_work_s*) [/vercel/path1/node_modules/sqlite3/lib/binding/node-v83-linux-x64/node_sqlite3.node]
11:01:05.627 | 9: 0x137750d [node]
11:01:05.628 | 10: 0x137bb06 [node]
11:01:05.628 | 11: 0x138e5e5 [node]
11:01:05.629 | 12: 0x137c438 uv_run [node]
11:01:05.630 | 13: 0xa44974 node::NodeMainInstance::Run() [node]
11:01:05.630 | 14: 0x9d1e15 node::Start(int, char**) [node]
11:01:05.630 | 15: 0x7fa5aaa500ba __libc_start_main [/lib64/libc.so.6]
11:01:05.631 | 16: 0x9694cc [node]
11:01:10.147 | Error: Command "npm run build" exited with SIGABRT
11:01:12.036 | [ 93.749747] ixgbevf 0000:00:04.0: NIC Link is Up 10 Gbps
11:01:12.036 | [ 93.751274] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
11:01:12.036 | [ 93.759749] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
11:01:12.036 | [ 190.681519] cgroup: cgroup: disabling cgroup2 socket matching due to net_prio or net_cls activation
<!--EndFragment-->
</body>
</html>
### Expected Behavior
This is how the build works locally, it compiles and runs with no issues.
> [email protected] build C:\Users\bwats\OneDrive\Desktop\autoTrader
> next build
(node:27076) ExperimentalWarning: The fs.promises API is experimental
warn - React 17.0.1 or newer will be required to leverage all of the upcoming features in Next.js 11. Read more: https://nextjs.org/docs/messages/react-version
info - Using webpack 5. Reason: no next.config.js https://nextjs.org/docs/messages/webpack5
info - Checking validity of types
info - Creating an optimized production build
warn - Compiled with warnings
./node_modules/formik/dist/formik.esm.js
Attempted import error: 'LowPriority' is not exported from 'scheduler' (imported as 'LowPriority').
info - Collecting page data
[ =] info - Generating static pages (0/5)(node:27152) ExperimentalWarning: The fs.promises API is experimental
(node:16600) ExperimentalWarning: The fs.promises API is experimental
[ ] info - Generating static pages (0/5)(node:13092) ExperimentalWarning: The fs.promises API is experimental
(node:17584) ExperimentalWarning: The fs.promises API is experimental
(node:19416) ExperimentalWarning: The fs.promises API is experimental
info - Generating static pages (5/5)
info - Finalizing page optimization
Page Size First Load JS
┌ λ / 1.73 kB 160 kB
├ /_app 0 B 137 kB
├ ○ /404 3.73 kB 140 kB
├ λ /api/cars 0 B 137 kB
├ λ /api/login 0 B 137 kB
├ λ /api/models 0 B 137 kB
├ λ /api/person/[id] 0 B 137 kB
├ λ /api/regions 0 B 137 kB
├ λ /api/signup 0 B 137 kB
├ λ /api/users 0 B 137 kB
├ λ /car/[make]/[brand]/[id] 5.3 kB 142 kB
├ λ /cars 2.88 kB 166 kB
├ ● /faq 5.89 kB 143 kB
├ ○ /Login 1.61 kB 182 kB
├ λ /search 2.23 kB 160 kB
├ ○ /Signup 3.59 kB 184 kB
├ λ /TableDemo 108 kB 245 kB
├ λ /user/[id] 11.9 kB 149 kB
└ λ /users 3.35 kB 166 kB
+ First Load JS shared by all 137 kB
├ chunks/168.f347cd.js 7.18 kB
├ chunks/196.e8aa13.js 4.53 kB
├ chunks/323.526595.js 10.4 kB
├ chunks/380.2e38b1.js 22.7 kB
├ chunks/381.5fd301.js 2.87 kB
├ chunks/433.dfcc79.js 13.2 kB
├ chunks/592.6d4df6.js 3.32 kB
├ chunks/665.b93fab.js 19.9 kB
├ chunks/756.f71aef.js 5.18 kB
├ chunks/86.b0bdbf.js 2.19 kB
├ chunks/framework.411e40.js 40.8 kB
├ chunks/main.4467e6.js 156 B
├ chunks/pages/_app.857e96.js 3.21 kB
├ chunks/webpack.47c685.js 1.14 kB
└ css/ccc840a95188a0511cd6.css 473 B
λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
○ (Static) automatically rendered as static HTML (uses no initial props)
● (SSG) automatically generated as static HTML + JSON (uses getStaticProps)
(ISR) incremental static regeneration (uses revalidate in getStaticProps)
### To Reproduce
Public GitHub Repository:
[GitHub Repo](https://github.com/TheBryceIsRight/solar_sail) | https://github.com/vercel/next.js/issues/25056 | https://github.com/vercel/next.js/pull/25063 | 7f73b658494644dbe8d5210653c59ecc7a1d317b | e6a05ee940abd1a8328dba826fc4d19947c78496 | "2021-05-12T15:16:05Z" | javascript | "2021-05-14T10:50:29Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 25,013 | ["packages/next/build/webpack-config.ts"] | webpack5 non-deterministic chunk name when importing css | ### What version of Next.js are you using?
10.2.0
### What version of Node.js are you using?
14.16.0
### What browser are you using?
chrome, safari
### What operating system are you using?
macOS
### How are you deploying your application?
pm2 - npm run build on each server
### Describe the Bug
When using webpack5, `npm run build` is not as idempotent as it should be, when using a custom app that imports css.
After deleting .next, `npm run build` creates one set of output, and a second `npm run build` creates different output - specifically, `static/chunks/webpack-[hash].js` has a different hash.
This does not happen when css is not imported. It does not happen when using webpack4.
### Expected Behavior
When using webpack5, chunk names should be the same across builds and rebuilds when the content does not change.
### To Reproduce
Start with https://github.com/vercel/next.js/tree/canary/examples/with-typescript .
Add `styles/globals.css` (the content probably doesn't matter):
```
html,
body {
padding: 0;
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
}
a {
color: inherit;
text-decoration: none;
}
* {
box-sizing: border-box;
}
```
Add `next.config.js` for a consistent buildId:
```
module.exports = {
generateBuildId: () => 'BUILD'
}
```
Add a custom `_app.js`:
```
import '../styles/globals.css'
function MyApp({ Component, pageProps }) {
return <Component {...pageProps} />
}
export default MyApp
```
Invoke `npm run build`. Note the `static/chunks/webpack-[hash].js` name. Invoke `npm run build` again. Note the filename is different. This is the bug.
Delete .next. Comment out `import '../styles/globals.css'`. `npm run build` twice again - this time, the filename remains the same.
Delete .next. Uncomment `import '../styles/globals.css'`. Add `future: { webpack5: false, },` to next.config.js . `npm run build` twice again - again, the filename remains the same.
So webpack5 and nextJS are being non-deterministic somehow when css is imported.
Impact: We are currently experiencing a production bug with NextJS and webpack5 where our chunk filenames are not deterministic across our multiple servers. Not sure if this bug is related, but downgrading to webpack4 fixes it. I had a hard time isolating the cause on our large codebase, but I did find this. Also might be related to #24116.
| https://github.com/vercel/next.js/issues/25013 | https://github.com/vercel/next.js/pull/25055 | 5f3351dbb8de71bcdbc91d869c04bc862a25da5f | 288984b1ea843465069ffa54fda048d9a745872c | "2021-05-12T00:23:58Z" | javascript | "2021-05-12T16:33:51Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 25,010 | ["docs/api-reference/create-next-app.md", "packages/create-next-app/README.md"] | `npx create-next-app` uses npm by default | ### What version of Next.js are you using?
10.2.0
### What version of Node.js are you using?
16.0.0
### What browser are you using?
Chrome 90.0.4430.212
### What operating system are you using?
macOS 11.3.1
### How are you deploying your application?
Not deploying
### Describe the Bug
Run `npx create-next-app` without the `--use-npm` flag and it installs using `npm`:
```
$ npx create-next-app
✔ What is your project named? … my-app
Creating a new Next.js app in /Users/k/p/my-app.
Installing react, react-dom, and next using npm...
added 268 packages, and audited 269 packages in 5s
44 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
Initialized a git repository.
Success! Created my-app at /Users/k/p/my-app
Inside that directory, you can run several commands:
npm run dev
Starts the development server.
npm run build
Builds the app for production.
npm start
Runs the built app in production mode.
We suggest that you begin by typing:
cd my-app
npm run dev
npm notice
npm notice New minor version of npm available! 7.10.0 -> 7.12.1
npm notice Changelog: https://github.com/npm/cli/releases/tag/v7.12.1
npm notice Run npm install -g [email protected] to update!
npm notice
$ ls -al package-lock.json package.json yarn.lock
ls: yarn.lock: No such file or directory
-rw-r--r-- 1 k staff 186470 May 11 22:01 package-lock.json
-rw-r--r-- 1 k staff 256 May 11 22:01 package.json
```
### Expected Behavior
It should install by default using `yarn`
### To Reproduce
```
npx create-next-app
```
**Additional Information**
I'm on an M1 MacBook with Yarn installed using Homebrew:
```
$ which yarn
/opt/homebrew/bin/yarn
``` | https://github.com/vercel/next.js/issues/25010 | https://github.com/vercel/next.js/pull/25079 | 7b0fe0d73b2a8eabc535afe171a91987b60163fa | 1cb83c1b351550f1b74eb7167e11ee62a6c1da2b | "2021-05-11T20:06:40Z" | javascript | "2021-05-13T10:39:21Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 24,991 | ["docs/advanced-features/i18n-routing.md", "docs/api-reference/next/router.md"] | Using http instead of https locally with localized domains | ### What version of Next.js are you using?
10.2
### What version of Node.js are you using?
14.16.1
### What browser are you using?
Chrome
### What operating system are you using?
macOS
### How are you deploying your application?
next start
### Describe the Bug
I have a Next.js application that uses two different domains for different languages. English uses .com and German uses .de. When I upgraded to Next.js 10, I rewrote the entire mechanism to use the built-in localization feature that supports multiple domains out of the box which is absolutely awesome and works like a charm in production.
However, I have had problems locally with development since then. When I click on a link, it automatically redirects to `https` which I am not using for development which of course leads to the browser not being able to connect to the page. I use the following domains for local development which, of course, are set up in `/etc/hosts`:
```
127.0.0.1 en.localhost
127.0.0.1 de.localhost
```
Of course, I can access the application over localhost without the subdomain and the links work perfectly fine, but then I have no way to distinguish between the languages for development. Anyone have any suggestions on how to work around this? Is this a bug that I should report?
### Expected Behavior
I expect to be able to disable `https` for local development regardless of the domain. Perhaps it would be a good idea to make it settable in the `next.config.js` file or as an env variable.
### To Reproduce
1. Create a Next.js application
2. Set up multiple locales using multiple domains as described in the docs: https://nextjs.org/docs/advanced-features/i18n-routing#locale-strategies
3. Add domains for local development with a config similar to this:
```
domains: [
{
domain: process.env.NODE_ENV === 'development' ? 'en.localhost' : 'somedomain.com',
defaultLocale: 'en',
},
{
domain: process.env.NODE_ENV === 'development' ? 'de.localhost' : 'irgendeinedomain.de'
defaultLocale: 'de',
}
]
```
4. Add the local domains to your hosts file:
```
127.0.0.1 en.localhost
127.0.0.1 de.localhost
```
5. Create at least 2 pages with links between them using the `next/link` component.
6. Click on a link.
7. The browser navigates to the page, but with `https`. | https://github.com/vercel/next.js/issues/24991 | https://github.com/vercel/next.js/pull/26492 | 917a9acc2cd8e16a7915d0b99d2ad398ede15d65 | c9119f845c16682a6985c4c983d5dabecdf76a2b | "2021-05-11T13:48:05Z" | javascript | "2021-06-22T17:52:26Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 24,977 | ["packages/next/server/server-route-utils.ts", "test/integration/custom-routes/test/index.test.js"] | TypeError [ERR_INVALID_CHAR]: Invalid character in header content ["Location"] | ### What version of Next.js are you using?
10.2.0
### What version of Node.js are you using?
12.21.0
### What browser are you using?
Chrome
### What operating system are you using?
MacOS
### How are you deploying your application?
`next start` on heroku
### Describe the Bug
Using some special characters in a URL query key crashes Next and gives a 500 with the following stack trace.
```
TypeError [ERR_INVALID_CHAR]: Invalid character in header content ["Location"]
at ServerResponse.setHeader (_http_outgoing.js:533:3)
at Object.fn (/app/node_modules/next/dist/next-server/server/next-server.js:53:938)
at Router.execute (/app/node_modules/next/dist/next-server/server/router.js:25:83)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Server.run (/app/node_modules/next/dist/next-server/server/next-server.js:68:1042)
at async Server.handleRequest (/app/node_modules/next/dist/next-server/server/next-server.js:32:504) {
code: 'ERR_INVALID_CHAR'
}
```
Seems like this has been a problem before in https://github.com/vercel/next.js/issues/17907, but was fixed for that set of characters.
### Expected Behavior
The Next server should return a 404.
### To Reproduce
* Bootstrap a new app with `create-next-app` and start it with either `next dev` or `next start`
* Visit the app with for example the following path: `http://localhost:3003/u/?%23%0d%0ahrs:hrs` (looks like it doesn't crash if you add the query to the root path)
* Observe the server throwing an `Internal server error` and returning 500.
| https://github.com/vercel/next.js/issues/24977 | https://github.com/vercel/next.js/pull/33763 | 5773c53f5f8ab216e9cad662ab3b89f9ecdfbe85 | f104e9105c929c343369747644a780d67171b557 | "2021-05-11T07:00:41Z" | javascript | "2022-01-28T16:20:34Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 24,889 | ["packages/next/build/index.ts"] | `next build` logs that it's type-checking even if type-checking is disabled | ### What version of Next.js are you using?
10.2
### What version of Node.js are you using?
12.20
### What browser are you using?
Chrome 90
### What operating system are you using?
Ubuntu 20.04
### How are you deploying your application?
next export
### Describe the Bug
with `ignoreBuildErrors: true` `next build` logs "Checking validity of types"
### Expected Behavior
No type-checking and no log indicating otherwise
### To Reproduce
```js
// next.config.js
module.exports = {
typescript: {
ignoreBuildErrors: true
}
}
``` | https://github.com/vercel/next.js/issues/24889 | https://github.com/vercel/next.js/pull/24440 | f6c60946a300cf0b29977ae027b0c0cc056d8602 | 7c7e86454e41997c4ffe0853da995c9ee012cbad | "2021-05-07T11:50:46Z" | javascript | "2021-05-07T14:34:15Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 24,872 | ["packages/next/build/webpack/plugins/font-stylesheet-gathering-plugin.ts", "packages/next/next-server/lib/constants.ts", "packages/next/next-server/lib/post-process.ts", "packages/next/next-server/server/font-utils.ts", "packages/next/pages/_document.tsx", "test/integration/font-optimization/fixtures/with-google/pages/_document.js", "test/integration/font-optimization/fixtures/with-typekit/manifest-snapshot.json", "test/integration/font-optimization/test/index.test.js"] | Font optimization - Typekit font loaded twice | ### What version of Next.js are you using?
10.2
### What version of Node.js are you using?
14.16.1
### What browser are you using?
Chrome
### What operating system are you using?
macOS
### How are you deploying your application?
next start
### Describe the Bug
Support for Typekit font were added in this PR - https://github.com/vercel/next.js/pull/24834
The font file for typekit is loaded twice as seen in the font-manifest.json
### Expected Behavior
Font file has to be added once in the font-manifest.json
### To Reproduce
Run the with typekit integration test and look at the font-manifest.json for the typekit font | https://github.com/vercel/next.js/issues/24872 | https://github.com/vercel/next.js/pull/25346 | 1cb4aaa35b01497b90943f63773fa8d13e8a8178 | 58a4482f75e94e2b9791069d39ce89f541858842 | "2021-05-06T20:53:46Z" | javascript | "2021-06-02T09:43:03Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 24,871 | ["packages/next/client/head-manager.ts", "packages/next/next-server/lib/head.tsx", "test/integration/build-output/test/index.test.js", "test/integration/font-optimization/fixtures/with-google/pages/index.js", "test/integration/font-optimization/fixtures/with-google/pages/with-font.js", "test/integration/font-optimization/fixtures/with-google/server.js", "test/integration/font-optimization/fixtures/with-typekit/pages/index.js", "test/integration/font-optimization/fixtures/with-typekit/pages/with-font.js", "test/integration/font-optimization/fixtures/with-typekit/server.js", "test/integration/font-optimization/test/index.test.js"] | Font optimization - Single page font does not trigger on client side nav | ### What version of Next.js are you using?
10.2
### What version of Node.js are you using?
14.16.1
### What browser are you using?
Chrome
### What operating system are you using?
macOS
### How are you deploying your application?
next start
### Describe the Bug
Issue 1 reported in this blog - https://dev.to/ekafyi/first-impressions-on-next-js-automatic-font-optimization-32a1
Fonts added to a single page via `next/head` don't load on navigation
Usually this isn't an issue since the best practice is to add fonts in `_document.js` and this case works well
When we want to load a font file only for a specific route we can add the font to the page via `next/head`. This isn't working as expected with the automatic webfont optimization.
### Expected Behavior
Font file added to a single route via `next/head` has to load during client side navigation
### To Reproduce
The blog has some examples.
Add a google font file to a single route via `next/head`
Navigate to that route from `/` via `next/link` | https://github.com/vercel/next.js/issues/24871 | https://github.com/vercel/next.js/pull/24968 | b859c5bdf5d8c2354e7e1bc4513d1714144f9024 | 6ad91722954049ffb5e23435f2b3fb4ba94d7cc2 | "2021-05-06T20:49:12Z" | javascript | "2021-05-12T11:39:26Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 24,781 | ["packages/next/build/webpack/plugins/font-stylesheet-gathering-plugin.ts", "test/integration/font-optimization/test/index.test.js"] | Automatic WebFont Optimization does not work | ### What version of Next.js are you using?
10.2.0
### What version of Node.js are you using?
14.15.4
### What browser are you using?
Chrome
### What operating system are you using?
macOS BigSur
### How are you deploying your application?
Vercel
### Describe the Bug
The font style is not inlined even though I added a link to`_document.tsx` in the following format.
(I'm sure using the `Head` component exported from `next/document`)
```jsx
<Html lang="ja">
<Head>
<meta charSet="utf-8" />
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+JP" rel="stylesheet" />
</Head>
<body>
<Main />
<NextScript />
</body>
</Html>
```
I forked next.js to use a local next.js, and the same thing happened.
When I run 'next build', `.next/server/font-manifest.json` will be generated, but its contents will be empty.
This probably happens only with certain fonts (maybe Japanese font?).
Also, if you run 'yarn dev' after 'yarn build', regardless of whether the font is Japanese or not, the `.next/server/font-manifest. json` was disappeared, is this a problem?
I found this issue([#19159](https://github.com/vercel/next.js/issues/19159)), but it was already closed and did not solve the problem.
### Expected Behavior
The tag is transformed as expected
- link href property is replaced with data-href of the same value
- style tag is created with the same data-href key/value
- style tag contains an inlined font definition
The .next/server/font-manifest.json contains font definitions as fetched from https://fonts.googleapis.com/css...
### To Reproduce
1. Build and start a server from my minimal repo:
```
git clone https://github.com/Co9xs/next-automatic-webfont-optimization-sample.git
cd next-automatic-webfont-optimization-sample
yarn
yarn build
yarn dev
```
2. Open http://localhost:3000/
3. Inspect the <head> of the document
4. Inspect the built .next/server/font-manifest.json file | https://github.com/vercel/next.js/issues/24781 | https://github.com/vercel/next.js/pull/25071 | b9b35d406cd95e1cfeff03e7e5e4640db39eb300 | de42719619ae69fbd88e445100f15701f6e1e100 | "2021-05-04T11:33:42Z" | javascript | "2021-05-19T10:05:12Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 24,775 | ["packages/next/build/webpack/loaders/next-serverless-loader/utils.ts", "test/integration/required-server-files/test/index.test.js"] | Encoded slashes not working as expected in production in a catch-all route | ### What version of Next.js are you using?
10.0.2
### What version of Node.js are you using?
14.16.1
### What browser are you using?
Firefox & Brave
### What operating system are you using?
Ubuntu Linux
### How are you deploying your application?
Vercel
### Describe the Bug
My application is using a catch-all route which tests that the slug length is 3 or less and returns `notFound` if other. The last slug part has an arbitrary content, including another slashes, but it's encoded using `encodeURIComponent` so it doesn't get to conflict with the catch-all filter.
Locally, everything works correctly, but in production (in Vercel) breaks when using slashes, as reported in TheDavidDelta/lingva-translate#18. I've tested this issue reports and it's not only in links but in everything that contains a slash i.e. https://lingva.ml/en/es/like%20%2F%20dislike, even though locally it works great (fell free to clone that repo to test it).
### Expected Behavior
To don't break nor send 404 when using encoded slashes on filtered catch-all routes, as works locally.
### To Reproduce
Go to https://lingva.ml and write any translation that contains a slash. | https://github.com/vercel/next.js/issues/24775 | https://github.com/vercel/next.js/pull/26963 | f8269fd4a6d09dcbc9cf8196d41df60b912aadda | c53b60a885d96e457aca6161717af9b0f459b749 | "2021-05-04T08:47:37Z" | javascript | "2021-07-06T21:28:43Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 24,768 | ["packages/next/next-server/server/api-utils.ts", "test/integration/api-body-parser/test/index.test.js"] | 500 error when content-type header is not formatted correctly | ### What version of Next.js are you using?
10.2.0
### What version of Node.js are you using?
14.16.1
### What browser are you using?
Chrome
### What operating system are you using?
Codesandbox
### How are you deploying your application?
next start
### Describe the Bug
When a request comes in to a `pages/api` endpoint, and the `content-type` header is not correctly formed, my API code does not run, and the request returns a 500 error.
I noticed this issue because I'm getting 500 responses for calls with a trailing semicolon in my production logs `"content-type": "application/x-www-form-urlencoded;"`
This does not happen for `getServerSideProps` calls.
`content-type` values that reach my code (and return 200 in the below reproduction):
* `text/plain`
* `text/abcdefg`
* `abc/defg`
* `abc/___`
* `abc/---`
`content-type` values that do not reach my code and always return a 500 error:
* `text` (anything without a slash)
* `/text` and `text/` (slash not in middle)
* `text/plain;` and `text;/plain` (trailing or containing semicolon)
### Expected Behavior
I would expect `getServerSideProps` and API routes to handle headers the same way. I expect the user to not be able to trigger a 500 error. I would expect either a) Next.js to return a 4xx status code, or b) Let my code handle the request as it wishes, treating any of these failing `content-type`s the same way it currently treats the `content-type` of `abc/def` or how `getServerSideProps` handles it.
I would much prefer option (b).
### To Reproduce
https://codesandbox.io/s/nifty-tharp-6w90w?file=/pages/api/test.js:94-100
Use Postman (or similar app) to hit the codesandbox `/api/test` route with a `content-type: text/plain;` header (note the trailing semicolon)
Any API endpoint can reproduce, for example:
```javascript
export default async (req, res) => {
res.setHeader("Content-Type", "text/plain");
res.end("OK");
};
``` | https://github.com/vercel/next.js/issues/24768 | https://github.com/vercel/next.js/pull/24818 | 192d42bcacf20e8b501b9c3e7d325c852f6796ee | 54ff3223b402b963baa189334587e2e590054276 | "2021-05-03T20:58:28Z" | javascript | "2021-05-05T14:27:44Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 24,703 | ["packages/next/client/image.tsx", "test/integration/image-component/default/pages/blurry-placeholder.js", "test/integration/image-component/default/test/index.test.js"] | Placeholder are always blank during lazy loading. | ### What version of Next.js are you using?
10.2.1-canary.2
### What version of Node.js are you using?
14.16.1
### What browser are you using?
Chrome, Firefox, Mobile Safari
### What operating system are you using?
Windows, iOS
### How are you deploying your application?
Vercel
### Describe the Bug
The placeholders introduced in #24153 are always blank during lazy loading.
### Expected Behavior
Placeholder are displayed until loading is complete.
### To Reproduce
```tsx
<Image
src="/test.jpg"
alt="photo"
width="1920"
height="1080"
layout="responsive"
placeholder="blur"
blurDataURL={dataURL}
/>
```
| https://github.com/vercel/next.js/issues/24703 | https://github.com/vercel/next.js/pull/24704 | 3b76d3371a4eca007c09e40afe4818bac6590d02 | 0a1d418a96dc016602bcec07cb4986d194d8c99f | "2021-05-02T04:25:32Z" | javascript | "2021-06-08T07:03:39Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 24,599 | ["packages/next/lib/load-custom-routes.ts", "packages/next/package.json", "packages/next/taskfile.js", "yarn.lock"] | Remove/Limit use of regexr and regexer-lexer, which introduce GPL-3.0 license into NextJS | ### Describe the feature you'd like to request
Prior to 10.1.4-canary.7, next contained no GPL-3.0 licensed dependencies. In 10.1.4-canary.7 and 10.2.0, the use of regexr-lexer (https://github.com/ijjk/regexr-lexer#3bcf3d1c4bc6dd9239c47acb1fb7b419823f8337) introduces the first GPL-3.0 licensed dependency (see https://unpkg.com/browse/[email protected]/dist/compiled/regexr-lexer/lexer.js). This will have a significant impact on which teams can use the next framework; GPL-3.0 is pretty clear about limiting use to free (as in software) projects. IANAL, but it seems Vercel itself might be non-compliant if it has any proprietary components? Was this change intentional? If not, can the next team please look for an alternative to regexr-lexer?
Here are the files using GPL:
- https://unpkg.com/browse/[email protected]/dist/compiled/regexr-lexer/lexer.js
- https://unpkg.com/browse/[email protected]/dist/compiled/regexr-lexer/profiles.js
- https://unpkg.com/browse/[email protected]/dist/lib/regexr/expression-lexer.js
- https://unpkg.com/browse/[email protected]/dist/lib/regexr/expression-lexer.js.map
- https://unpkg.com/browse/[email protected]/dist/lib/regexr/profile/core.js
- https://unpkg.com/browse/[email protected]/dist/lib/regexr/profile/core.js.map
- https://unpkg.com/browse/[email protected]/dist/lib/regexr/profile/javascript.js
- https://unpkg.com/browse/[email protected]/dist/lib/regexr/profile/javascript.js.map
Thanks!
### Describe the solution you'd like
Remove all GPL-3.0 and LGPL-3.0 dependencies from next
### Describe alternatives you've considered
Fork next with GPL-3.0 and LGPL-3.0 dependencies replaced/removed | https://github.com/vercel/next.js/issues/24599 | https://github.com/vercel/next.js/pull/24604 | 89d2c4e19829fad49fc25ccca2f2d3a94b77da01 | 1e441fe440f48b83b1dcc1a08ddcc5d3dd112d28 | "2021-04-29T13:35:55Z" | javascript | "2021-04-29T17:50:06Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 24,570 | ["packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts", "test/development/acceptance/ReactRefreshModule.test.ts"] | dev mode breaks when local variable _a or _b is already defined (ReactRefreshModule runtime) | ### What version of Next.js are you using?
10.2
### What version of Node.js are you using?
10
### What browser are you using?
all
### What operating system are you using?
macOS
### How are you deploying your application?
I wish I could
### Describe the Bug
With 10.2, create the following page:
```
import { default as _a } from "next/link";
export default function IndexPage() {
console.log(_a);
return <div>Hello World.</div>;
}
```
and start the server in dev mode (next dev). It fails with the following error:
```
⠁ error - ./pages/index.js
Module parse failed: Identifier '_a' has already been declared (21:8)
File was processed with these loaders:
* ./node_modules/@next/react-refresh-utils/loader.js
* ./node_modules/next/dist/build/webpack/loaders/next-babel-loader.js
You may need an additional loader to handle the result of these loaders.
|
| ;
> var _a, _b;
| // Legacy CSS implementations will `eval` browser code in a Node.js context
| // to extract CSS. For backwards compatibility, we need to check we're in a
```
it's caused by the fast refresh plugin concatenating the source code with the runtime code (@next/react-refresh-utils/internal/ReactRefreshModule.runtime.js) which redefines _a and _b vars, causing the error.
There is no reason why ReactRefreshModule.runtime.js needs to use var, it should use let to scope the variables inside the function.
### Expected Behavior
The page works.
### To Reproduce
https://codesandbox.io/s/next-102-react-refresh-bug-qvzg5 | https://github.com/vercel/next.js/issues/24570 | https://github.com/vercel/next.js/pull/33638 | 0d642f1264b5dd20fe4bacb9470e95877bcaf273 | 7e95e300633467dd9f3e99d0e3269c7b5b28c271 | "2021-04-28T19:10:34Z" | javascript | "2022-01-27T14:22:35Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 24,473 | ["packages/next/client/image.tsx"] | [next/image] On IE11, with layout="responsive" | "fill" + sizes prop, object doesn't support property "matchAll" | ### What version of Next.js are you using?
10.1.3, also tried 10.1.4-canary.16
### What version of Node.js are you using?
14.15.0
### What browser are you using?
IE11
### What operating system are you using?
Windows 10
### How are you deploying your application?
next start, locally
### Describe the Bug
On IE11, when using `<Image layout="responsive" />` (or fill) in addition to the `sizes` prop, I get the following error:
`Object doesn't support property "matchAll"`
The stacktrace points to this code:
```
function(e,t,r){if(r&&("fill"===t||"responsive"===t)){var n=o(r.matchAll(/(^|\s)(1?\d?\d)vw/g)).map(
```
If I remove the `sizes` prop, no error occurs.
### Expected Behavior
The docs state that "Next.js supports IE11 and all modern browsers (Edge, Firefox, Chrome, Safari, Opera, et al) with no required configuration.".
### To Reproduce
```
<Image
src="https://hips.hearstapps.com/hmg-prod.s3.amazonaws.com/images/golden-retriever-royalty-free-image-506756303-1560962726.jpg?crop=0.672xw:1.00xh;0.166xw,0&resize=640:*"
layout="fill"
sizes="
(min-width: 85.375rem) 17.5rem,
(min-width: 64rem) 25vw,
(min-width: 37.5rem) 50vw,
100vw
"
/>
```
next build
next start | https://github.com/vercel/next.js/issues/24473 | https://github.com/vercel/next.js/pull/24569 | a35dedb7d3c5c7e0912c9e41bdebd9f971d6739c | 89d2c4e19829fad49fc25ccca2f2d3a94b77da01 | "2021-04-26T14:27:36Z" | javascript | "2021-04-29T10:07:27Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 24,422 | ["packages/next/export/index.ts", "test/integration/export/pages/gsp-notfound.js", "test/integration/export/pages/index.js", "test/integration/export/test/browser.js"] | Returning `notFound` from `getStaticProps` causes an error during `next export` | ### What version of Next.js are you using?
10.1.3, 10.1.4-canary.16
### What version of Node.js are you using?
14.15.3
### What browser are you using?
Firefox 89.0b3
### What operating system are you using?
Ubuntu 18.04.5 LTS
### How are you deploying your application?
next export
### Describe the Bug
If a page returns `{ notFound: true }` from `getStaticProps`, then running `next build && next export` will result in an error like the following:
```
> [email protected] export /home/ahurle/Documents/Programming/next-notfound-ssg-bug
> next export
info - Using webpack 4. Reason: future.webpack5 option not enabled https://nextjs.org/docs/messages/webpack5
info - using build directory: /home/ahurle/Documents/Programming/next-notfound-ssg-bug/.next
info - Copying "static build" directory
info - No "exportPathMap" found in "next.config.js". Generating map from "./pages"
info - Launching 7 workers
info - Copying "public" directory
info - Exporting (3/3)
[Error: ENOENT: no such file or directory, copyfile '/home/ahurle/Documents/Programming/next-notfound-ssg-bug/.next/server/pages/blog/post.html' -> '/home/ahurle/Documents/Programming/next-notfound-ssg-bug/out/blog/post.html'] {
errno: -2,
code: 'ENOENT',
syscall: 'copyfile',
path: '/home/ahurle/Documents/Programming/next-notfound-ssg-bug/.next/server/pages/blog/post.html',
dest: '/home/ahurle/Documents/Programming/next-notfound-ssg-bug/out/blog/post.html'
}
```
It seems like `next export` expects an html file to be present, but there isn't one.
### Expected Behavior
No error message, `next export` finishes successfully, and visiting `/blog/post` in production results in a 404 just like when I use `next build && next start` locally
### To Reproduce
You can find a minimal reproduction with instructions in the readme here: https://github.com/fracture91/next-notfound-ssg-bug There's also a [canary branch](https://github.com/fracture91/next-notfound-ssg-bug/compare/canary) showing the issue still exists in 10.1.4-canary.16
For a little context, my use case is I want to be able to see unpublished blog posts in dev mode, but production builds should exclude them and result in a 404. [Here is my "real" code where I hit the problem, plus a hacky workaround](https://github.com/fracture91/ahurle-dev/blob/83922ad222cce787fec5c222182253b8e50c63ac/helpers/getBlogStaticProps.ts#L50-L54).
Another potential workaround is to avoid using `next export` in my Vercel deploy, since [my example repo seems to work fine with `next build` alone](https://next-notfound-ssg-bug.vercel.app/blog/post).
These comments look like the same problem: https://github.com/vercel/next.js/issues/19578#issuecomment-747113659 https://github.com/vercel/next.js/discussions/20355 | https://github.com/vercel/next.js/issues/24422 | https://github.com/vercel/next.js/pull/24481 | 2333f7c1b882dff09b944967a29162f9aca42e7d | 88f27ef9477e2e417c35dc7373ea0c99b2d98d5e | "2021-04-24T16:45:49Z" | javascript | "2021-09-18T15:20:45Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 24,401 | ["examples/with-passport/package.json"] | Running the with-passport example | ### What example does this report relate to?
Running the with-passport example
### What version of Next.js are you using?
latest
### What version of Node.js are you using?
16.0.0
### What browser are you using?
not important
### What operating system are you using?
same error occurred on both macOS and Linux Mint
### How are you deploying your application?
not deployed
### Describe the Bug
Running the README command results in error:
```
npx create-next-app --example with-passport with-passport-app
```
Error message mentions some stuff around peer dependencies
### Expected Behavior
produces a next.js project
### To Reproduce
run the command anywhere in a home directory | https://github.com/vercel/next.js/issues/24401 | https://github.com/vercel/next.js/pull/24567 | 6b97bcea5ba851740404e8192fc9ebff711e1b83 | 2d6b56086ea161e3e135927d7d79b3439210e726 | "2021-04-23T16:58:36Z" | javascript | "2021-04-28T19:19:22Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 24,334 | ["packages/next/build/index.ts", "packages/next/server/dev/hot-reloader.ts", "packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts", "packages/react-refresh-utils/loader.ts", "test/e2e/type-module-interop/index.test.ts"] | Issue with backend-side ES6 imports with "type":"module" with an express/nextjs setup | ### What version of Next.js are you using?
10.1.3
### What version of Node.js are you using?
15.9.0
### What browser are you using?
Chrome
### What operating system are you using?
MacOS
### How are you deploying your application?
Running locally via express
### Describe the Bug
I have an Express.js server that sets up Next.js, and I want to use ES6 modules with my backend.
My package.json has the line `"type": "module"`, which enables ES6 module support in Node.js. Everything is imported fine, but when I try to load a page, I get the following exception:
```
error - Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /Users/alexey/work/alexey/temp/.next/server/pages/_document.js
require() of ES modules is not supported.
require() of /Users/alexey/work/alexey/temp/.next/server/pages/_document.js from /Users/alexey/work/alexey/temp/node_modules/next/dist/next-server/server/require.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename _document.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/alexey/work/alexey/temp/package.json.
at new NodeError (node:internal/errors:329:5)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1108:13)
at Module.load (node:internal/modules/cjs/loader:971:32)
at Function.Module._load (node:internal/modules/cjs/loader:812:14)
at Module.require (node:internal/modules/cjs/loader:995:19)
at require (node:internal/modules/cjs/helpers:92:18)
at requirePage (/Users/alexey/work/alexey/temp/node_modules/next/dist/next-server/server/require.js:1:1184)
at loadComponents (/Users/alexey/work/alexey/temp/node_modules/next/dist/next-server/server/load-components.js:1:795)
at DevServer.findPageComponents (/Users/alexey/work/alexey/temp/node_modules/next/dist/next-server/server/next-server.js:77:296)
at DevServer.renderErrorToHTML (/Users/alexey/work/alexey/temp/node_modules/next/dist/next-server/server/next-server.js:139:29)
at DevServer.renderErrorToHTML (/Users/alexey/work/alexey/temp/node_modules/next/dist/server/next-dev-server.js:35:1392)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:94:5)
at async DevServer.renderError (/Users/alexey/work/alexey/temp/node_modules/next/dist/next-server/server/next-server.js:138:1659) {
code: 'ERR_REQUIRE_ESM'
}
```
Indeed, looking at `.next/server/pages/_document.js`, it has a `var installedModules = require('../ssr-module-cache.js');` directive, which is against the rules for `"type": "module"`.
This seems to imply that I can not use Next.js with ES6 syntax in Node - which is too bad!
### Expected Behavior
I think what I would expect is that Next.js would compile in a way that's compatible with ES6 modules - i.e. when `"type": "module"` is enabled, it relies on `import`, not `require`
### To Reproduce
I've created a minimal setup where I'm able to get this to reproduce:
package.json
```
{
"scripts": {
"start": "node index.js"
},
"name": "es6_import_issue",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"author": "Alexey Chernikov",
"dependencies": {
"express": "^4.17.1",
"next": "^10.1.3",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"type": "module"
}
```
index.js
```
/*
This style works if I don't do "type": "module"
in package.json - main.jsx loads fine!
*/
/*
const express = require('express');
const next = require('next');
const http = require('http');
*/
/*
With this style and "type": "module" in package.json
I get the error described
*/
import express from 'express';
import next from 'next';
import http from 'http';
class Server {
constructor(port) {
this.port = port;
this.express = express();
this.next = next({ dev: process.env.NODE_ENV !== 'production' });
}
async start() {
await this.next.prepare();
this.express.get('/', (req, res) => {
return this.next.render(req, res, `/main`, req.query);
})
this.express.get('*', (req, res) => {
return this.next.render(req, res, `/${req.path}`, req.query);
})
this.server = http.createServer(this.express);
this.server.listen(this.port);
}
}
const begin = async () => {
const port = 3000;
new Server(port).start();
console.log(`Server running on port ${port}`);
};
begin();
```
And also in pages/main.jsx:
```
const hello = () => {
return <div>
Hello world
</div>
}
export default hello
```
With this setup, after a `yarn install` and `yarn start`, I see the error above. I left the `require` style that works fine w/o a `"type": "module"` directive in comments so it's quick to test that this Express+Next.js setup is in fact functional.
| https://github.com/vercel/next.js/issues/24334 | https://github.com/vercel/next.js/pull/33637 | 127f94dc13ec8c40169b2dbd24e1187deb944ea2 | 62b1704e41fa58a21f558653c4fb9f2e10defccf | "2021-04-22T02:19:06Z" | javascript | "2022-02-15T16:24:11Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 24,287 | ["packages/next/next-server/lib/router/router.ts", "test/integration/i18n-support/test/shared.js"] | Duplicate locale key in path when using browser back button | ### What version of Next.js are you using?
10.1.4-canary.12
### What version of Node.js are you using?
14.16.0
### What browser are you using?
Chrome, Safari, Firefox
### What operating system are you using?
macOS
### How are you deploying your application?
next start
### Describe the Bug
Using `router.push` or `next/link` to push to the same path with only query parameter changes results in a duplicated locale in the path when navigating back using the browsers back button.
ex. `/fr` -> `/fr?value=1` -> `/fr?value=2` -> press browser back button -> `/fr/fr?value=1`
Related to this issue, if any `rewrites` are defined in next.config.js and you have a dynamic route at the same directory level, pressing the back button will result in the dynamic page being rendered instead of the previous page.
I have checked the issues and the closest issue I could find was #23553, which was resolved in `10.1.4-canary.10`, however as of `10.1.4-canary.12` this issue still persists.
### Expected Behavior
Locale is not duplicated in url path when navigating back using browsers back button
### To Reproduce
1. Create a fresh nextjs project `yarn create next-app`
2. (optional) Change the `next` version in the package.json to `10.1.4-canary.12` and reinstall packages.
3. Replace the contents of `/pages/index.js` with:
```
import Link from 'next/link';
import { useRouter } from 'next/router';
import { useMemo } from 'react';
import styles from '../styles/Home.module.css'
export default function Home() {
const router = useRouter();
const nextValue = useMemo(() => {
return Math.floor(Math.random() * 1000);
}, [router.query.value]);
return (
<div className={styles.container}>
<Link
passHref
locale="fr"
href={{
pathname: '/',
query: { value: nextValue.toString() }
}}
>
<a>Go to {nextValue}</a>
</Link>
</div>
);
};
```
4. Create a next.config.js file and add:
```
module.exports = {
i18n: {
locales: ['en-US', 'fr'],
defaultLocale: 'en-US'
}
};
```
5. Start dev server `yarn dev`
6. Follow the link on the page 2+ times then press the browsers back button. You should see the path as `/fr/fr?value=<some number>`
To see the effect with `rewrites` defined in next.config.js:
1. Add `rewrites` definitions to the config (from my testing it doesn't matter what the rewrites are, as long as it's defined):
```
async rewrites() {
return {
fallback: [
{
source: '/:path*',
destination: '/:path*',
},
]
}
},
```
2. Add a dynamic page to pages root `/pages/[test].js`:
```
export default function Test() {
return (
<div>Test Page</div>
);
};
```
3. Restart dev server.
4. Follow the link on the page 2+ times then press the browsers back button. You'll see that the url is `/fr/fr?value=<some number>` and the dynamic `[test].js` page was rendered instead.
If you remove the `rewrites` from next.config.js but keep the dynamic page, pressing the back button does not result in the dynamic page being rendered and the correct page is rendered. However, the issue with the pathname still persists. | https://github.com/vercel/next.js/issues/24287 | https://github.com/vercel/next.js/pull/24323 | 2979f30087d7e9ee4600e5a260997b79e816f593 | a29d8c9eaf693f6022ef4b0584fa3bc51fb57dfc | "2021-04-20T22:09:55Z" | javascript | "2021-04-22T03:06:26Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 24,277 | ["packages/next/client/image.tsx", "test/integration/image-component/noscript/pages/index.js", "test/integration/image-component/noscript/test/index.test.js"] | Wrong noscript img src attribute with next/image and loaders | ### What version of Next.js are you using?
10.1.3
### What version of Node.js are you using?
12.21.0
### What browser are you using?
Chrome
### What operating system are you using?
Windows 10
### How are you deploying your application?
Vercel
### Describe the Bug
Using any loader with the `next\image` component, the `<img>` inside the `<noscript>` tag has a relative image url instead of absolute:
``` html
<noscript>
<img
...
src="/sample.jpg"
srcSet="https://res.cloudinary.com/../sample.jpg 1x
/></noscript>
```
### Expected Behavior
the url in the src attribute must containt the external domain too
``` html
<noscript>
<img
...
src="https://res.cloudinary.com/../sample.jpg"
srcSet="https://res.cloudinary.com/../sample.jpg 1x
/></noscript>
```
### To Reproduce
https://codesandbox.io/s/practical-borg-emkz4 | https://github.com/vercel/next.js/issues/24277 | https://github.com/vercel/next.js/pull/24011 | 2ac47d219398109c7af8dd2372304bac0eb2f042 | 22676abb31387086defba59edc6afa2b10f3033a | "2021-04-20T16:56:29Z" | javascript | "2021-06-16T20:53:40Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 24,206 | ["packages/next/build/index.ts", "packages/next/next-server/server/next-server.ts", "test/integration/500-page/test/index.test.js"] | Issue using _error and 500 page | ### What version of Next.js are you using?
10.1.3
### What version of Node.js are you using?
14.15.4
### What browser are you using?
Chrome
### What operating system are you using?
macOS
### How are you deploying your application?
Vercel
### Describe the Bug
I am using Sentry so set up an _error.tsx file in the pages directory. I also need to setup custom 404 and 500 pages with specific branding (which requires a call to the fs module during build). The 404.tsx page works great, but I cannot get the 500.tsx to work during an actual error.
If I go to `/500` the page renders great. However, if I set up new page `/test/error` that just throws an error server side, my 500 page partially renders, but most of the content gets replaced with `An unexpected error has occurred.`
I tried multiple things to get around it, including moving the entire contents of the 500 to the _error.tsx. However, this fails to build since it seems that fs cannot be used there in the Error.getInitialProps function like it can in the getStaticProps function.
I
### Expected Behavior
The documentation does not say that _error and 500 cannot be used together. So I would expect my custom 500 page to render just like my custom 400 page. There seems to be something else going on though since if I delete the custom 500 page, I get a plain white 500 page that just says `Internal Server Error` regardless of what content I return in my _error.tsx. And if I delete my _error.tsx, the behavior of my custom 500 is the same as described above.
### To Reproduce
404.tsx (works):
```ts
import { promises as fs } from 'fs';
import path from 'path';
import clsx from 'clsx';
import { GetStaticProps } from 'next';
import Head from 'next/head';
import Image from 'next/image';
import Link from 'next/link';
import { useRouter } from 'next/router';
import React, { FC, useEffect, useMemo } from 'react';
import { gql } from 'graphql-request';
import { useSession } from 'next-auth/client';
import { getPageTitle } from '../utils';
import styles from '../styles/404.module.scss';
import { LogAction, MutationWriteLogArgs } from '../generated/graphql';
import { fetcher } from '../utils/graphql';
type NotFoundProps = {
images: string[];
};
const NotFound: FC<NotFoundProps> = ({ images }) => {
const router = useRouter();
const [session, loading] = useSession();
const image = useMemo<string>(
() => images[Math.floor(Math.random() * images.length)],
// eslint-disable-next-line react-hooks/exhaustive-deps
[router.asPath],
);
useEffect((): void => {
const writeLog = async (): Promise<void> => {
const sub = (session?.user.id || null) as null | string;
const args: MutationWriteLogArgs = {
data: {
logAction: LogAction.Error404,
logMessage: router.asPath,
sub,
},
};
const query = gql`
mutation WriteToLog($data: WriteLogInput!) {
writeLog(data: $data) {
logID
}
}
`;
await fetcher<
{
writeLog: {
logID: number;
};
},
MutationWriteLogArgs
>(query, args);
};
if (!loading) {
writeLog();
}
}, [router.asPath, session, loading]);
return (
<div className="row">
<Head>
<title>{getPageTitle('404')}</title>
</Head>
<div className="content-bg text-dark mx-auto mt-6 pb-4 col-md-6">
<h1 className="text-center">404</h1>
<div
className={clsx('mx-auto', 'position-relative', styles['image-404'])}
>
<Image
alt="Branded image"
layout="fill"
objectFit="contain"
objectPosition="center center"
src={image}
/>
</div>
<h4 className="text-center">
Something has gone wrong.
</h4>
<div className="text-center">
<Link href="/">
<a>Please click here to return home</a>
</Link>
</div>
</div>
</div>
);
};
// ts-prune-ignore-next
export const getStaticProps: GetStaticProps = async () => {
const imagesDirectory = path.join(process.cwd(), 'public', '404');
const imageNames = await fs.readdir(imagesDirectory);
const images = imageNames.map(image => `/404/${image}`);
return { props: { images } };
};
NotFound.whyDidYouRender = true;
// ts-prune-ignore-next
export default NotFound;
```
500.tsx (renders two outer divs, but all other content is replaced with message):
```ts
import { promises as fs } from 'fs';
import path from 'path';
import clsx from 'clsx';
import { GetStaticProps } from 'next';
import Head from 'next/head';
import Image from 'next/image';
import Link from 'next/link';
import { useRouter } from 'next/router';
import React, { FC, useMemo } from 'react';
import { useSession } from 'next-auth/client';
import styles from '../styles/500.module.scss';
import { getPageTitle } from '../utils';
type ErrorProps = {
images: string[];
};
const Error: FC<ErrorProps> = ({ images }) => {
const router = useRouter();
const [session, loading] = useSession();
const image = useMemo<string>(
() => images[Math.floor(Math.random() * images.length)],
// eslint-disable-next-line react-hooks/exhaustive-deps
[router.asPath],
);
return (
<div className="row">
<Head>
<title>{getPageTitle('500')}</title>
</Head>
<div className="content-bg text-dark mx-auto mt-6 pb-4 col-md-6">
<h1 className="text-center">Error Occurred</h1>
<div
className={clsx('mx-auto', 'position-relative', styles['image-500'])}
>
<Image
alt="Branded image"
layout="fill"
objectFit="contain"
objectPosition="center center"
src={image}
/>
</div>
<h2 className="text-center">
There has been an error.
<br />
<a
href="#"
onClick={(event): false => {
event.preventDefault();
router.reload();
return false;
}}
>
Please try reloading the page
</a>
</h2>
{!loading && <h4 className="text-center">or</h4>}
{!loading && (
<h2 className="text-center">
{session ? (
<Link href="/">
<a>Click here to return to your dashboard</a>
</Link>
) : (
<Link href="/auth/login">
<a>Click here to return to the login page</a>
</Link>
)}
</h2>
)}
</div>
</div>
);
};
// ts-prune-ignore-next
export const getStaticProps: GetStaticProps = async () => {
const imagesDirectory = path.join(process.cwd(), 'public', '500');
const imageNames = await fs.readdir(imagesDirectory);
const images = imageNames.map(image => `/500/${image}`);
return { props: { images } };
};
Error.whyDidYouRender = true;
// ts-prune-ignore-next
export default Error;
```
_error.tsx (Does not seem to render at all)
```ts
import * as Sentry from '@sentry/browser';
import { NextPage, NextPageContext } from 'next';
import NextErrorComponent from 'next/error';
import React from 'react';
type ErrorPageProps = {
err?: unknown;
hasGetInitialPropsRun?: boolean;
statusCode: number;
};
const ErrorPage: NextPage<ErrorPageProps> = ({
err,
hasGetInitialPropsRun,
statusCode,
}) => {
if (!hasGetInitialPropsRun && err) {
// getInitialProps is not called in case of
// https://github.com/vercel/next.js/issues/8592. As a workaround, we pass
// err via _app.js so it can be captured
Sentry.captureException(err);
}
return <NextErrorComponent statusCode={statusCode} />;
};
ErrorPage.getInitialProps = async ({ res, err, asPath }) => {
const errorInitialProps = await NextErrorComponent.getInitialProps({
res,
err,
} as NextPageContext);
// Workaround for https://github.com/vercel/next.js/issues/8592, mark when
// getInitialProps has run
(errorInitialProps as ErrorPageProps).hasGetInitialPropsRun = true;
// Running on the server, the response object (`res`) is available.
//
// Next.js will pass an err on the server if a page's data fetching methods
// threw or returned a Promise that rejected
//
// Running on the client (browser), Next.js will provide an err if:
//
// - a page's `getInitialProps` threw or returned a Promise that rejected
// - an exception was thrown somewhere in the React lifecycle (render,
// componentDidMount, etc) that was caught by Next.js's React Error
// Boundary. Read more about what types of exceptions are caught by Error
// Boundaries: https://reactjs.org/docs/error-boundaries.html
if (res?.statusCode === 404) {
// Opinionated: do not record an exception in Sentry for 404
return { statusCode: 404 };
}
if (err) {
Sentry.captureException(err);
await Sentry.flush(2000);
return errorInitialProps;
}
// If this point is reached, getInitialProps was called without any
// information about what the error might be. This is unexpected and may
// indicate a bug introduced in Next.js, so record it in Sentry
Sentry.captureException(
new Error(`_error.js getInitialProps missing data at path: ${asPath}`),
);
// Without this try-catch block, builds all fail since
// Sentry.flush throws `false` here during static builds
try {
await Sentry.flush(2000);
} catch (error) {
console.log('Sentry.flush failed to be called:', error);
}
return errorInitialProps;
};
// ts-prune-ignore-next
export default ErrorPage;
```
/test/error.tsx (Test error page):
```ts
import { GetServerSideProps } from 'next';
import React, { FC } from 'react';
const TestError: FC = () => <h1>Test Page</h1>;
export const getServerSideProps: GetServerSideProps = async () => {
throw new Error('Testing 500 page');
};
// ts-prune-ignore-next
export default TestError;
```
| https://github.com/vercel/next.js/issues/24206 | https://github.com/vercel/next.js/pull/23586 | eddf5e0de9af1f07cf079da6cd6ed8c173351ca8 | 0402fc459eb12a775372172a351f3a3f4fee83e3 | "2021-04-18T22:05:21Z" | javascript | "2021-06-11T09:29:40Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 24,184 | ["examples/with-magic/package.json"] | npx create-next-app not working with with-magic example app | ### What version of Next.js are you using?
latest
### What version of Node.js are you using?
v14.15.5
### What browser are you using?
Chrome
### What operating system are you using?
macOS
### How are you deploying your application?
npx create-next-app --example with-magic with-magic-app
### Describe the Bug
<img width="614" alt="Screen Shot 2021-04-17 at 2 44 03 PM" src="https://user-images.githubusercontent.com/18686388/115127442-5fb68600-9f8b-11eb-9121-77c523939045.png">
getting this error when installing example app
### Expected Behavior
should install
### To Reproduce
npx create-next-app --example with-magic with-magic-app | https://github.com/vercel/next.js/issues/24184 | https://github.com/vercel/next.js/pull/24185 | 2e7d405fedbc9c07135ece14c6f7f2ac18a81a2a | 557ecb0fa27badea42d1b82012529d29a3ef7959 | "2021-04-17T21:44:40Z" | javascript | "2021-04-17T22:26:43Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 24,177 | ["packages/next/next-server/server/image-optimizer.ts", "test/integration/image-optimizer/test/index.test.js"] | TypeError: e.on is not a function when using example with-zones | ### What version of Next.js are you using?
10.1.3
### What version of Node.js are you using?
15.14.0
### What browser are you using?
Chrome
### What operating system are you using?
macOS
### How are you deploying your application?
Vercel
### Describe the Bug
When i run the [with-zones](https://github.com/vercel/next.js/tree/canary/examples/with-zones) example and serving `http://localhost:3000/blog` i get the following error:
```
TypeError: e.on is not a function
at Array.stream (/Users/niklas/DEV/with-zones-app/home/node_modules/next/dist/compiled/http-proxy/index.js:1:15064)
at ProxyServer.<anonymous> (/Users/niklas/DEV/with-zones-app/home/node_modules/next/dist/compiled/http-proxy/index.js:1:12072)
at Object.fn (/Users/niklas/DEV/with-zones-app/home/node_modules/next/dist/next-server/server/next-server.js:58:278)
at Router.execute (/Users/niklas/DEV/with-zones-app/home/node_modules/next/dist/next-server/server/router.js:25:83)
at async DevServer.run (/Users/niklas/DEV/with-zones-app/home/node_modules/next/dist/next-server/server/next-server.js:69:1042)
at async DevServer.handleRequest (/Users/niklas/DEV/with-zones-app/home/node_modules/next/dist/next-server/server/next-server.js:34:504)
at async imageOptimizer (/Users/niklas/DEV/with-zones-app/home/node_modules/next/dist/next-server/server/image-optimizer.js:3:4266)
at async Router.execute (/Users/niklas/DEV/with-zones-app/home/node_modules/next/dist/next-server/server/router.js:25:67)
at async DevServer.run (/Users/niklas/DEV/with-zones-app/home/node_modules/next/dist/next-server/server/next-server.js:69:1042)
at async DevServer.handleRequest (/Users/niklas/DEV/with-zones-app/home/node_modules/next/dist/next-server/server/next-server.js:34:504)
node:events:346
throw er; // Unhandled 'error' event
^
Error: socket hang up
at connResetException (node:internal/errors:642:14)
at TLSSocket.socketOnEnd (node:_http_client:496:23)
at TLSSocket.emit (node:events:381:22)
at endReadableNT (node:internal/streams/readable:1307:12)
at processTicksAndRejections (node:internal/process/task_queues:81:21)
Emitted 'error' event on ClientRequest instance at:
at TLSSocket.socketOnEnd (node:_http_client:496:9)
at TLSSocket.emit (node:events:381:22)
at endReadableNT (node:internal/streams/readable:1307:12)
at processTicksAndRejections (node:internal/process/task_queues:81:21) {
code: 'ECONNRESET'
}
error Command failed with exit code 1.
```
i noticed that the image from `/blog/static/nextjs.png` can't be loaded.
### Expected Behavior
When i serve `http://localhost:3000/blog` the image from the url `/blog/static/nextjs.png` should be loaded, the error `TypeError: e.on is not a function` should disappear and the dev server should not hang up
### To Reproduce
1. create a new next app with the multi-zones example
```
yarn create next-app --example with-zones with-zones-app
```
2. install all dependencies in `home` and `blog`
```
cd home
yarn
cd ..
cd blog
yarn
```
3. start the `/home`
```
cd home
yarn dev
```
4. visit `http://localhost:3000/blog` | https://github.com/vercel/next.js/issues/24177 | https://github.com/vercel/next.js/pull/21001 | 432c9ee5fcf7687e0dae2252a7eed2277c954d16 | 9fcfce3463095af63e93251ae12f5cac8344aa7f | "2021-04-17T14:13:22Z" | javascript | "2021-04-17T21:03:08Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 24,075 | ["packages/next/client/link.tsx", "packages/next/next-server/lib/router/router.ts", "test/integration/dynamic-routing/pages/[name]/index.js", "test/integration/dynamic-routing/test/index.test.js"] | next/link constructs incorrect hash links and throws on dynamic pages | ### What version of Next.js are you using?
10.1.3
### What version of Node.js are you using?
14.16.1
### What browser are you using?
Firefox
### What operating system are you using?
Ubuntu
### How are you deploying your application?
n/a
### Describe the Bug
on dynamic pages with `getStaticPaths`, `next/link` will construct incorrect links when used for linking to fragment identifiers like this:
```jsx
<Link href="#somewhere"><a>Go</a></Link>
/* or */
<Link href={{ hash: 'somewhere' }}><a>Go</></Link>
```
the links will assume `router.pathname`, e.g. `/posts/[id]#somewhere`, which will throw:

### Expected Behavior
`next/link` should behave like a native anchor, i.e. `<a href="#somewhere">Go</a>`.
(why not simply use native anchors instead of `next/link`? because of correct scroll restoration, see [here](https://github.com/vercel/next.js/issues/16746#issuecomment-789970857))
### To Reproduce
1. clone https://github.com/stefanprobst/issue-next-link-hash
2. `yarn && yarn dev`
2. Go to `http://localhost:3000/posts/post`
3. Click link, see error overlay | https://github.com/vercel/next.js/issues/24075 | https://github.com/vercel/next.js/pull/24199 | d5de1c53c188f4e041f86a728766ca69b967a437 | 9bbb968c43b8c79692b22a54e2045c66463fe49f | "2021-04-14T19:25:49Z" | javascript | "2021-04-30T16:34:23Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 24,070 | ["packages/next/client/index.tsx", "packages/next/next-server/server/load-components.ts", "packages/next/next-server/server/next-server.ts", "test/acceptance/ReactRefreshLogBox.dev.test.js"] | Top level error thrown in pages/_app causes app to render internal server error | ### What version of Next.js are you using?
next@canary
### What version of Node.js are you using?
latest
### What browser are you using?
Chrome
### What operating system are you using?
macOS
### How are you deploying your application?
Does not affect this bug
### Describe the Bug
When a top-level error is thrown in `pages/_app.js` the `internal server error` case is hit.
### Expected Behavior
The error should be rendered.
### To Reproduce
A reproduction is provided in this failing test PR: https://github.com/vercel/next.js/pull/24069 | https://github.com/vercel/next.js/issues/24070 | https://github.com/vercel/next.js/pull/24079 | 1e207301c2e33a81607c7678200b0be03594a025 | 1797fc50ab6a6059a3d118236dcd9cbf22ef91b8 | "2021-04-14T17:40:32Z" | javascript | "2021-04-15T10:19:19Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 24,056 | ["packages/next/server/hot-reloader.ts", "test/acceptance/ReactRefreshLogBox.dev.test.js"] | Errors in server compilation result in a 404 instead of showing the error overlay | ### What version of Next.js are you using?
next@canary
### What version of Node.js are you using?
latest
### What browser are you using?
Chrome
### What operating system are you using?
macOS
### How are you deploying your application?
Does not affect this bug
### Describe the Bug
Recently found an edge case where if the server compilation fails we'll render a 404 page instead of showing the error overlay. This is obviously not what we'd want. It was surfaced in rauchg's blog and I've opened a PR with a failing test here: https://github.com/vercel/next.js/pull/24054
### Expected Behavior
The webpack error is surfaced instead of showing a 404 page
### To Reproduce
A reproduction is provided as as failing test in https://github.com/vercel/next.js/pull/24054 | https://github.com/vercel/next.js/issues/24056 | https://github.com/vercel/next.js/pull/24331 | 85d87a37957f76ff0e0d6b7f19bcd1f9efdd3c5d | 6cd1c874519b615ee5ca246c2497e166fc969a5f | "2021-04-14T13:03:25Z" | javascript | "2021-04-22T11:47:15Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 24,047 | ["packages/next/server/server-route-utils.ts", "test/integration/custom-routes/test/index.test.js"] | TypeError [ERR_INVALID_CHAR]: Invalid character in header content ["Location"] | ### What version of Next.js are you using?
10.1.3
### What version of Node.js are you using?
15.14.0
### What browser are you using?
Chrome, Firefox
### What operating system are you using?
macOS
### How are you deploying your application?
Other platform
### Describe the Bug
While redirecting, application responds with Internal Server Error when sending request with invalid characters in query key.
### Expected Behavior
Normal redirect is performed
### To Reproduce
1. Send the request.
If `trailingSlash` is enabled, `curl "http://localhost:3000/anypath?%E2%80%9D"`
If `trailingSlash` is **not** enabled, `curl "http://localhost:3000/anypath/?%E2%80%9D"`
2. `Internal Server Error` is returned
https://nodejs.org/api/http.html#http_response_setheader_name_value
> Attempting to set a header field name or value that contains invalid characters will result in a TypeError being thrown.
```
TypeError [ERR_INVALID_CHAR]: Invalid character in header content ["Location"]
at ServerResponse.setHeader (node:_http_outgoing:576:3)
at Object.fn (/node_modules/next/next-server/server/next-server.ts:893:19)
at Router.execute (/node_modules/next/next-server/server/router.ts:342:40)
at DevServer.run (/node_modules/next/next-server/server/next-server.ts:1227:41)
at DevServer.run (/node_modules/next/server/next-dev-server.ts:419:18)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:94:5)
at DevServer.handleRequest (/node_modules/next/next-server/server/next-server.ts:573:14) {
code: 'ERR_INVALID_CHAR'
}
``` | https://github.com/vercel/next.js/issues/24047 | https://github.com/vercel/next.js/pull/33763 | 5773c53f5f8ab216e9cad662ab3b89f9ecdfbe85 | f104e9105c929c343369747644a780d67171b557 | "2021-04-14T08:57:04Z" | javascript | "2022-01-28T16:20:34Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 23,901 | ["packages/next/bundles/yarn.lock", "packages/next/compiled/webpack/bundle5.js"] | Webpack 5 cache issue with `NEXT_PUBLIC_` environment variables | ### What version of Next.js are you using?
10.1.3
### What version of Node.js are you using?
14.16.0
### What browser are you using?
N/A
### What operating system are you using?
macOS 11.2.3
### How are you deploying your application?
N/A
### Describe the Bug
When using Webpack 5, `yarn build` might not replace [`NEXT_PUBLIC_` environment variables](https://nextjs.org/docs/basic-features/environment-variables#exposing-environment-variables-to-the-browser) with their values as expected in Webpack 4. This is probably because of the Webpack cache that Next.js keeps across builds when Webpack 5 is enabled.
In our production build, when we first enabled Webpack 5, all envvars are replaced correctly. However, in subsequent builds, some or all envvars are not replaced, which led to subtle bugs.
### Expected Behavior
All `NEXT_PUBLIC_` envvars should be replaced correctly during `yarn build` regardless of the Webpack 5 cache.
### To Reproduce
Please refer to [this repo](https://github.com/minhtule/nextjs-webpack5-envvar). It contains a basic Next.js app and steps to reproduce a similar issue with Webpack 5 cache and Next.js envvar. | https://github.com/vercel/next.js/issues/23901 | https://github.com/vercel/next.js/pull/24077 | 279e105279f3c95d22ec13cb915766e25956f658 | 1e207301c2e33a81607c7678200b0be03594a025 | "2021-04-12T06:12:06Z" | javascript | "2021-04-14T21:23:13Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 23,896 | ["packages/next/next-server/lib/post-process.ts", "test/integration/font-optimization/pages/with-font.js", "test/integration/font-optimization/pages/without-font.js", "test/integration/font-optimization/test/index.test.js"] | Font optimization - style tag for custom fonts is included on pages without a link to a font provider | ### What version of Next.js are you using?
10.1.4-canary.3
### What version of Node.js are you using?
14.15
### What browser are you using?
Chrome
### What operating system are you using?
macOS
### How are you deploying your application?
next start, Vercel
### Describe the Bug
I've two pages - one with a `link` tag to a custom font (https://nextjs-fonts-optimization-bug.vercel.app/with-font) and one without custom font (https://nextjs-fonts-optimization-bug.vercel.app/without-font).
When I start on the page with a custom font then a `style` tag is included in all pages until I'll restart the server.
I think this behaviour appears only when using `getServerSideProps` - I couldn't reproduce the bug consistently without it.
### Expected Behavior
The generated `style` tag should be included only for pages with a `link` tag to a custom font.
### To Reproduce
https://nextjs-fonts-optimization-bug.vercel.app/with-font
https://nextjs-fonts-optimization-bug.vercel.app/without-font
repo: https://github.com/ArekBartnik/nextjs-fonts-optimization-bug | https://github.com/vercel/next.js/issues/23896 | https://github.com/vercel/next.js/pull/24162 | fc538790ecbedc98fb3e35accbf9c76edcf70030 | fff183c4cda2ed3ba719cc6224806d895998cc15 | "2021-04-11T17:25:25Z" | javascript | "2021-04-26T18:30:21Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 23,830 | ["examples/with-tailwindcss-emotion/package.json", "examples/with-tailwindcss-emotion/postcss.config.js", "examples/with-tailwindcss-emotion/tailwind.config.js"] | Update Tailwind CSS example with emotion to use JIT | ### What example does this report relate to?
https://github.com/vercel/next.js/tree/canary/examples/with-tailwindcss-emotion
### What version of Next.js are you using?
latest
### What version of Node.js are you using?
latest
### What browser are you using?
any
### What operating system are you using?
any
### How are you deploying your application?
any
### Describe the Bug
Follow this PR https://github.com/vercel/next.js/pull/23793 but for the other Tailwind example
### Expected Behavior
Uses JIT :smile:
### To Reproduce
Clone the example
| https://github.com/vercel/next.js/issues/23830 | https://github.com/vercel/next.js/pull/23912 | 2186f1eb551d57d64db3d0a836b064243e13fd3a | 698ab55cb7eb213eebb2b019acc179ec8fd882cf | "2021-04-08T16:48:43Z" | javascript | "2021-04-20T02:57:15Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 23,824 | ["packages/next/server/base-server.ts", "test/e2e/dynamic-route-interpolation/index.test.ts"] | Dynamic API routes : explicilty requesting url with dynamic slug as [slug] | ### What version of Next.js are you using?
10.1.3
### What version of Node.js are you using?
v12.16.3
### What browser are you using?
Firefox
### What operating system are you using?
Ubuntu
### How are you deploying your application?
next dev
### Describe the Bug
When requesting a url with a dynamic segment (ex : `/my/path/[slug]`) with that slug not being replaced by anything (ex : `https://mysite.web/my/path/[slug]`), I got the following error :
`The provided `href` (/my/path/[slug]?) value is missing query values (slug) to be interpolated properly. Read more: https://nextjs.org/docs/messages/href-interpolation-failed`
### Expected Behavior
To behave as if the slug was wrong (ex : `/my/path/foo` or `/my/path/[bar]`).
### To Reproduce
https://codesandbox.io/s/dynamic-routes-slug-k7jui | https://github.com/vercel/next.js/issues/23824 | https://github.com/vercel/next.js/pull/33808 | 39d3210776d37e7dc11e77b54a65b33b5454c0ce | 965d26eba373e760c5440054c76d77ea20d96fef | "2021-04-08T14:57:09Z" | javascript | "2022-02-02T02:57:04Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 23,770 | ["examples/with-typescript-graphql/pages/index.tsx"] | Fix typescript type error. | ### What example does this report relate to?
with-typescript-graphql
### What version of Next.js are you using?
latest
### What version of Node.js are you using?
14.16.0
### What browser are you using?
Firefox
### What operating system are you using?
PopOS(ubuntu 20.04)
### How are you deploying your application?
not deploying at all
### Describe the Bug
The error is related to typescript as you can see in the image below.
### Expected Behavior
Typescript plugin in vscode should be fixed. The example works well already in broser though.
### To Reproduce
```bash
yarn
yarn dev
```
Now open VScode to see the typescript error and you would see two errors there as I have demonstrated in below images.
## Issues
1. Return the codeflow if data is not returned from the mutation, and that fixes this warning.

2. Supply typescript typings for the target cache object.

| https://github.com/vercel/next.js/issues/23770 | https://github.com/vercel/next.js/pull/23771 | b2ee0a93fe5653a050550455d817f7e460205b4a | 15133b47ec7bfc413aa068d92fb678626cf47571 | "2021-04-07T13:25:11Z" | javascript | "2021-04-15T18:55:30Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 23,742 | ["packages/next/client/future/image.tsx", "packages/next/client/image.tsx", "test/integration/image-component/base-path/test/index.test.js", "test/integration/image-component/default/test/index.test.js", "test/integration/image-future/base-path/test/index.test.js", "test/integration/image-future/default/test/index.test.js"] | Image is missing required "src" property, but stack trace does not inform where | ### What version of Next.js are you using?
10.1.3
### What version of Node.js are you using?
15.11.0
### What browser are you using?
Firefox
### What operating system are you using?
Linux
### How are you deploying your application?
next dev
### Describe the Bug
Some image in the middle of the hundreds of images I have has an empty src. The error message helps nothing to find this particular image:
```
Error: Image is missing required "src" property. Make sure you pass "src" in props to the `next/image` component. Received: {}
at Image (webpack-internal:///../../node_modules/next/dist/client/image.js:185:13)
at processChild (/home/rsa/skyfall/frontend/node_modules/react-dom/cjs/react-dom-server.node.development.js:3353:14)
at resolve (/home/rsa/skyfall/frontend/node_modules/react-dom/cjs/react-dom-server.node.development.js:3270:5)
at ReactDOMServerRenderer.render (/home/rsa/skyfall/frontend/node_modules/react-dom/cjs/react-dom-server.node.development.js:3753:22)
at ReactDOMServerRenderer.read (/home/rsa/skyfall/frontend/node_modules/react-dom/cjs/react-dom-server.node.development.js:3690:29)
at renderToString (/home/rsa/skyfall/frontend/node_modules/react-dom/cjs/react-dom-server.node.development.js:4298:27)
at Object.renderPage (/home/rsa/skyfall/frontend/node_modules/next/dist/next-server/server/render.js:54:854)
at Function.getInitialProps (webpack-internal:///../../node_modules/next/dist/pages/_document.js:141:19)
at loadGetInitialProps (/home/rsa/skyfall/frontend/node_modules/next/dist/next-server/lib/utils.js:5:101)
at renderToHTML (/home/rsa/skyfall/frontend/node_modules/next/dist/next-server/server/render.js:54:1145)
at processTicksAndRejections (node:internal/process/task_queues:94:5)
at async /home/rsa/skyfall/frontend/node_modules/next/dist/next-server/server/next-server.js:112:97
at async /home/rsa/skyfall/frontend/node_modules/next/dist/next-server/server/next-server.js:105:142
at async DevServer.renderToHTMLWithComponents (/home/rsa/skyfall/frontend/node_modules/next/dist/next-server/server/next-server.js:137:387)
at async DevServer.renderToHTML (/home/rsa/skyfall/frontend/node_modules/next/dist/next-server/server/next-server.js:138:522)
at async DevServer.renderToHTML (/home/rsa/skyfall/frontend/node_modules/next/dist/server/next-dev-server.js:35:578)
```
### Expected Behavior
I'm not sure it's possible, but it would be good to know where the offending Image has been instantiated, so I could know where to put checks and guards.
### To Reproduce
Add one image with an empty src in the middle of several others.
| https://github.com/vercel/next.js/issues/23742 | https://github.com/vercel/next.js/pull/38847 | 672bdaee403c5f6ab3c7181c683849dfcf94942f | cdb0c47455aadcb0eeea4e250a669b4000b90e63 | "2021-04-06T13:17:11Z" | javascript | "2022-07-20T21:26:38Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 23,724 | ["packages/next/export/index.ts", "test/integration/no-op-export/test/index.test.js", "test/lib/next-test-utils.js"] | Error: invariant: progress total can not be zero | ### What version of Next.js are you using?
10.1.3
### What version of Node.js are you using?
15.12.0
### What browser are you using?
-
### What operating system are you using?
Ubuntu 20.04
### How are you deploying your application?
-
### Describe the Bug
When running `npm run build` next js throws an error (`Error: invariant: progress total can not be zero`) and the build fails
### Expected Behavior
It builds without an error
### To Reproduce
repo: https://github.com/SimonSiefke/nextjs-progress-bug
```js
// pages/[[...slug.js]]
export default function Home() {
return <div></div>
}
export const getStaticProps = () => {
return {}
}
export const getStaticPaths = () => {
return {
paths: [], // empty for demo, usually there will be data which comes from a cms
fallback: false,
}
}
```
```js
// pages/_error.js
import React from 'react'
class Error extends React.Component {
static getInitialProps({ res, err }) {
const statusCode = (res && res.statusCode) || (err && err.statusCode)
return { statusCode }
}
render() {
return <div></div>
}
}
export default Error
```
Run `npm run build`
The build fails with `Error: invariant: progress total can not be zero`

| https://github.com/vercel/next.js/issues/23724 | https://github.com/vercel/next.js/pull/23752 | f7d0bd115cb3abebaee16359e0ba103ecd273426 | 348115036ca01590b7f5f109eed9eca6e5a78843 | "2021-04-06T08:49:39Z" | javascript | "2021-04-06T17:12:23Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 23,716 | ["packages/next/build/webpack-config.ts", "test/integration/dist-dir/test/index.test.js"] | distDir is not fully respected when using webpack5 | ### What version of Next.js are you using?
canary
### What version of Node.js are you using?
12.16.3
### What browser are you using?
Chrome
### What operating system are you using?
macOS
### How are you deploying your application?
next start
### Describe the Bug
`.next` folder is being created for webpack5 cache files even if we use `distDir` config.
### Expected Behavior
cache files should be placed inside the folder referenced by `distDir`.
### To Reproduce
```bash
$ npx create-next-app my-app
$ cd ./my-app
$ npm install
$ touch next.config.js
```
```javascript
// next.config.js
module.exports = {
distDir: 'build/.next',
future: {
webpack5: true
}
}
```
| https://github.com/vercel/next.js/issues/23716 | https://github.com/vercel/next.js/pull/23718 | 9986d7c92ef2c9613a8338be777221cfa80b195b | c2c1b965440fd6ce062c0601a077a0a31021ae83 | "2021-04-06T05:21:22Z" | javascript | "2021-04-06T08:32:29Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 23,713 | ["errors/link-passhref.md", "errors/manifest.json", "packages/eslint-plugin-next/lib/index.js", "packages/eslint-plugin-next/lib/rules/link-passhref.js", "test/eslint-plugin-next/link-passhref.unit.test.js"] | ESLint rule for using <Link> without <a> child and ensuring passHref is used | ### Describe the feature you'd like to request
Until the RFC for `<Link to="/route">` lands solving https://github.com/vercel/next.js/issues/5533, we should provide better guidance to users when they're doing something inaccessible.
https://github.com/vercel/next.js/discussions/8207
### Describe the solution you'd like
If you use a `<Link>` without an `<a>` child and don't use `passHref=true`, show a warning.
### Describe alternatives you've considered
N/A
| https://github.com/vercel/next.js/issues/23713 | https://github.com/vercel/next.js/pull/24670 | 2330bf9dddcc3b01a3bb59f19801ba8b3a9da4ed | 569da9d2863691daa3958129cdbe46450f7784a9 | "2021-04-06T00:58:42Z" | javascript | "2021-05-10T18:35:11Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 23,687 | ["docs/api-reference/next/link.md"] | Link prefetching only works in production mode, not in development mode | ### What version of Next.js are you using?
10.0.7
### What version of Node.js are you using?
v12.18.2
### What browser are you using?
Chrome
### What operating system are you using?
macOS
### How are you deploying your application?
next dev
### Describe the Bug
When I run my app using `next dev`, link preloading doesn't work.
The documentation (https://nextjs.org/docs/api-reference/next/link) says this about preloading:
"prefetch - Prefetch the page in the background. Defaults to true. Any <Link /> that is in the viewport (initially or through scroll) will be preloaded. Prefetch can be disabled by passing prefetch={false}. Pages using Static Generation will preload JSON files with the data for faster page transitions"
It doesn't mention that this doesn't work in development mode, so this is either a bug or the documentation is incomplete.
### Expected Behavior
I expect links to be preloaded when I run my app using `next dev`. Otherwise, I can't get an accurate feel for how performant my app is unless I build it with `next build` and run it with `next start` (which is slower than just using `next dev`).
### To Reproduce
All you need to do to repro is use a Link component and see if it preloads when you run the app with `next dev`.
| https://github.com/vercel/next.js/issues/23687 | https://github.com/vercel/next.js/pull/23732 | 23ad3a718950557d2e42e6ccc0302f363064f5a5 | d2dc91c80ce9708aae6055cff1ef6cb9f67bf98a | "2021-04-04T23:14:12Z" | javascript | "2021-04-07T16:07:32Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 23,677 | ["packages/next/client/image.tsx"] | Error with sizes on the standard <Image> component | ### What version of Next.js are you using?
10.1.3
### What version of Node.js are you using?
10.22.1
### What browser are you using?
Chrome
### What operating system are you using?
macOS
### How are you deploying your application?
development (no deploy)
### Describe the Bug
Using this code:
<Image
src="/images/lorem.jpg"
height={150}
width={850}
layout="responsive"
sizes="50vw" // <== 👈 Commenting this line it works
alt="Lorem ipsum"
/>
returns this error
TypeError: sizes.matchAll(...) is not a function or its return value is not iterable
[![enter image description here][1]][1]
And without `_document.js` the error is:
[![enter image description here][2]][2]
Actual code of a standard page (`pages/about.js`)
```
import Image from 'next/image'
export default function About() {
return (
<>
<Image
src="/images/profile.jpg" // Route of the image file
height={444} // Desired size with correct aspect ratio
width={844} // Desired size with correct aspect ratio
layout="responsive"
sizes="50vw"
alt="Your Name"
className="image"
/>
</>
)
}
```
[1]: https://i.stack.imgur.com/m6BAP.jpg
[2]: https://i.stack.imgur.com/ws54x.jpg
### Expected Behavior
No error
### To Reproduce
Include an `<Image>` component with `sizes`
| https://github.com/vercel/next.js/issues/23677 | https://github.com/vercel/next.js/pull/24569 | a35dedb7d3c5c7e0912c9e41bdebd9f971d6739c | 89d2c4e19829fad49fc25ccca2f2d3a94b77da01 | "2021-04-04T07:49:06Z" | javascript | "2021-04-29T10:07:27Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 23,623 | ["packages/next/build/webpack/loaders/next-serverless-loader/page-handler.ts", "packages/next/next-server/server/next-server.ts", "test/integration/gssp-redirect-base-path/pages/gsp-blog/[post].js", "test/integration/gssp-redirect-base-path/pages/gssp-blog/[post].js", "test/integration/gssp-redirect-base-path/test/index.test.js", "test/integration/gssp-redirect/pages/gsp-blog/[post].js", "test/integration/gssp-redirect/pages/gssp-blog/[post].js", "test/integration/gssp-redirect/test/index.test.js"] | Redirecting externally in getServerSideProps with basePath | ### What version of Next.js are you using?
10.1.0
### What version of Node.js are you using?
12.18.0
### What browser are you using?
Chrome
### What operating system are you using?
macOS
### How are you deploying your application?
Other
### Describe the Bug
When redirecting to an external URL in getServerSideProps with a basePath, the destination path is instead appending to the current url.
```
return {
redirect: {
destination: 'https://www.google.com',
permanent: false
}
}
```
`localhost:3000` becomes `localhost:3000https://www.google.com`
### Expected Behavior
It should redirect with a basePath externally
### To Reproduce
1. Add a basePath
2. Add this to a getServerSideProps:
```
return {
redirect: {
destination: 'https://www.google.com',
permanent: false
}
}
```
| https://github.com/vercel/next.js/issues/23623 | https://github.com/vercel/next.js/pull/23673 | c2c1b965440fd6ce062c0601a077a0a31021ae83 | 55c6b7aba2dbf07e07a9daf82fbcab394308a60d | "2021-04-02T00:25:06Z" | javascript | "2021-04-06T10:02:13Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 23,607 | ["examples/with-reason-relay/pages/index.js"] | Fix examples that aren't working locally | These examples are currently not running locally.
- [x] custom-routes-proxying
- [x] with-compiled-css
- [x] with-glamor
- [x] with-mqtt-js
- [x] with-reason-relay
- [x] with-style-sheet
- [x] with-styled-jsx-plugins
- [x] with-web-worker
### Expected Behavior
They're updated and working locally, with instructions included in the README as necessary :pray:
### To Reproduce
Clone those examples using `npx create-next-app -e example-name`
| https://github.com/vercel/next.js/issues/23607 | https://github.com/vercel/next.js/pull/23780 | c5cf9e4c699d1fc9bede97f83b42003d7b64ff0b | d34c9f16d88e3a95d42c14fc4e82786077aaeaee | "2021-04-01T15:24:09Z" | javascript | "2021-04-07T19:18:56Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 23,553 | ["packages/next/next-server/lib/router/router.ts", "test/integration/i18n-support/test/shared.js"] | Regional Locale duplicate route on back button pressed | ### What version of Next.js are you using?
10.0.9
### What version of Node.js are you using?
14.15
### What browser are you using?
Chrome
### What operating system are you using?
Windows
### How are you deploying your application?
Vercel
### Describe the Bug
When using regional locale like fr-CA and en-CA, after navigating with Next/Link, the browser go back button append the locale twice in the url.
### Expected Behavior
The locale should only be present once in the url
### To Reproduce
1) Create a NextJS project with i18n and two regional locale (fr-CA, en-CA)
2) Using the url, navigate to the page locale (https://localhost:3000/fr-ca/login let's say).
3) From the page, navigate using Next/Link to another page. (https://localhost:3000/fr-ca/login let's say). You should see the regional locale being transform to uppercase. (fr-ca -> fr-CA). Go back to the previous page using the browser back button.
4) The path is now /fr-CA/fr-ca/
| https://github.com/vercel/next.js/issues/23553 | https://github.com/vercel/next.js/pull/24187 | d2b0d43eb92a6dbc6194e2361b4f3c079e76d47a | a153b63240f38488a7a82eb6c54e9f8890ab7a22 | "2021-03-30T14:25:59Z" | javascript | "2021-04-18T09:01:01Z" |
closed | vercel/next.js | https://github.com/vercel/next.js | 23,541 | ["packages/next/build/index.ts", "packages/next/next-server/server/next-server.ts", "test/integration/500-page/test/index.test.js"] | Error occurred prerendering page "/500" | ### What version of Next.js are you using?
10.1.1+
### What version of Node.js are you using?
15.1.0
### What browser are you using?
---
### What operating system are you using?
Windows
### How are you deploying your application?
next build
### Describe the Bug
On building app faced with error
```
Error occurred prerendering page "/500". Read more: https://nextjs.org/docs/messages/prerender-error
Error: Error for page /_error: pages with `getServerSideProps` can not be exported. See more info here: https://nextjs.org/docs/messages/gssp-export
...
> Build error occurred
Error: Export encountered errors on following paths:
/500
/en/500
/ru/500
/uk/500
```
### Expected Behavior
No errors, because I have no `/500.tsx` file,
I have only `/_error.tsx` with `getServerSideProps`
### To Reproduce
---
At 10.0.7 version - all works fine.
After update to new 10.1.x+ version - got error again like at https://github.com/vercel/next.js/issues/22815#issuecomment-792379150 | https://github.com/vercel/next.js/issues/23541 | https://github.com/vercel/next.js/pull/23586 | eddf5e0de9af1f07cf079da6cd6ed8c173351ca8 | 0402fc459eb12a775372172a351f3a3f4fee83e3 | "2021-03-30T10:39:53Z" | javascript | "2021-06-11T09:29:40Z" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.