-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for returning 404 from getStaticProps #17755
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Stats from current PRDefault Server Mode (Increase detected
|
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
buildDuration | 11.7s | 11.7s | ✓ |
nodeModulesSize | 63.4 MB | 63.4 MB |
Page Load Tests Overall increase ✓
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.253 | 2.208 | -0.04 |
/ avg req/sec | 1109.83 | 1132.12 | +22.29 |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.305 | 1.168 | -0.14 |
/error-in-render avg req/sec | 1916.01 | 2141.15 | +225.14 |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
677f882d2ed8..9b19.js gzip | 11.1 kB | 11.1 kB | |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-ef5fcfe..d66c.js gzip | 7.24 kB | 7.24 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
Overall change | 58 kB | 58 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.9 kB | 6.93 kB | |
framework.HA..dule.js gzip | 39 kB | 39 kB | ✓ |
main-1c7f28c..dule.js gzip | 6.29 kB | 6.29 kB | ✓ |
webpack-07c5..dule.js gzip | 751 B | 751 B | ✓ |
Overall change | 52.9 kB | 52.9 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
_app-9a0b9e1..b37e.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-ed1b0..8fbd.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-89731c..c609.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-409b283..e3ab.js gzip | 1.32 kB | 1.32 kB | ✓ |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
Overall change | 7.73 kB | 7.73 kB | ✓ |
Client Pages Modern
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
_app-75d3a82..dule.js gzip | 625 B | 625 B | ✓ |
_error-4469a..dule.js gzip | 2.29 kB | 2.29 kB | ✓ |
hooks-cbf13f..dule.js gzip | 387 B | 387 B | ✓ |
index-b9a643..dule.js gzip | 226 B | 226 B | ✓ |
link-92d3016..dule.js gzip | 1.28 kB | 1.28 kB | ✓ |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-f..dule.js gzip | 282 B | 282 B | ✓ |
Overall change | 5.37 kB | 5.37 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
_buildManifest.js gzip | 323 B | 323 B | ✓ |
_buildManife..dule.js gzip | 329 B | 329 B | ✓ |
Overall change | 652 B | 652 B | ✓ |
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
index.html gzip | 1 kB | 1 kB | -2 B |
link.html gzip | 1.01 kB | 1.01 kB | ✓ |
withRouter.html gzip | 995 B | 996 B | |
Overall change | 3.01 kB | 3.01 kB | -1 B |
Diffs
Diff for 677f882d2ed8..4eeebf399.js
@@ -957,6 +957,12 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
return fetchRetry(url, attempts - 1);
}
+ if (res.status === 404) {
+ // TODO: handle reloading in development from fallback returning 200
+ // to on-demand-entry-handler causing it to reload periodically
+ throw new Error("NOT_FOUND");
+ }
+
throw new Error("Failed to load static props");
}
@@ -971,7 +977,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
// We should only trigger a server-side transition if this was caused
// on a client-side transition. Otherwise, we'd get into an infinite
// loop.
- if (!isServerRender) {
+ if (!isServerRender || err.message === "NOT_FOUND") {
markLoadingError(err);
}
Diff for 677f882d2ed8..20.module.js
@@ -813,6 +813,12 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
return fetchRetry(url, attempts - 1);
}
+ if (res.status === 404) {
+ // TODO: handle reloading in development from fallback returning 200
+ // to on-demand-entry-handler causing it to reload periodically
+ throw new Error("NOT_FOUND");
+ }
+
throw new Error("Failed to load static props");
}
@@ -825,7 +831,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
// We should only trigger a server-side transition if this was caused
// on a client-side transition. Otherwise, we'd get into an infinite
// loop.
- if (!isServerRender) {
+ if (!isServerRender || err.message === "NOT_FOUND") {
markLoadingError(err);
}
Diff for index.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.d950dcaaa011f2b8e120.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.801220ef39ce9387de65.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -121,13 +121,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5472d08d2594eeebf399.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.666f15fc46f64e266fa1.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.d950dcaaa011f2b8e120.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.801220ef39ce9387de65.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for link.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.d950dcaaa011f2b8e120.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.801220ef39ce9387de65.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -126,13 +126,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5472d08d2594eeebf399.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.666f15fc46f64e266fa1.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.d950dcaaa011f2b8e120.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.801220ef39ce9387de65.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for withRouter.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.d950dcaaa011f2b8e120.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.801220ef39ce9387de65.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -121,13 +121,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5472d08d2594eeebf399.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.666f15fc46f64e266fa1.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.d950dcaaa011f2b8e120.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.801220ef39ce9387de65.module.js"
async=""
crossorigin="anonymous"
type="module"
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
buildDuration | 14.2s | 14.4s | |
nodeModulesSize | 63.4 MB | 63.4 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
677f882d2ed8..9b19.js gzip | 11.1 kB | N/A | N/A |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-ef5fcfe..d66c.js gzip | 7.24 kB | 7.24 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..cc2d.js gzip | N/A | 11.1 kB | N/A |
Overall change | 58 kB | 58 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.9 kB | N/A | N/A |
framework.HA..dule.js gzip | 39 kB | 39 kB | ✓ |
main-1c7f28c..dule.js gzip | 6.29 kB | 6.29 kB | ✓ |
webpack-07c5..dule.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..dule.js gzip | N/A | 6.93 kB | N/A |
Overall change | 52.9 kB | 52.9 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
_app-9a0b9e1..b37e.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-ed1b0..8fbd.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-89731c..c609.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-409b283..e3ab.js gzip | 1.32 kB | 1.32 kB | ✓ |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
Overall change | 7.73 kB | 7.73 kB | ✓ |
Client Pages Modern
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
_app-75d3a82..dule.js gzip | 625 B | 625 B | ✓ |
_error-4469a..dule.js gzip | 2.29 kB | 2.29 kB | ✓ |
hooks-cbf13f..dule.js gzip | 387 B | 387 B | ✓ |
index-b9a643..dule.js gzip | 226 B | 226 B | ✓ |
link-92d3016..dule.js gzip | 1.28 kB | 1.28 kB | ✓ |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-f..dule.js gzip | 282 B | 282 B | ✓ |
Overall change | 5.37 kB | 5.37 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
_buildManifest.js gzip | 323 B | 323 B | ✓ |
_buildManife..dule.js gzip | 329 B | 329 B | ✓ |
Overall change | 652 B | 652 B | ✓ |
Serverless bundles Overall increase ⚠️
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
_error.js | 1.05 MB | 1.05 MB | |
404.html | 4.34 kB | 4.34 kB | ✓ |
hooks.html | 3.92 kB | 3.92 kB | ✓ |
index.js | 1.05 MB | 1.05 MB | |
link.js | 1.1 MB | 1.1 MB | |
routerDirect.js | 1.09 MB | 1.09 MB | |
withRouter.js | 1.09 MB | 1.09 MB | |
Overall change | 5.41 MB | 5.41 MB |
Stats from current PRDefault Server Mode (Increase detected
|
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
buildDuration | 12.6s | 12.7s | |
nodeModulesSize | 63.4 MB | 63.4 MB |
Page Load Tests Overall decrease ⚠️
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.308 | 2.402 | |
/ avg req/sec | 1083.07 | 1040.73 | |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.264 | 1.283 | |
/error-in-render avg req/sec | 1977.63 | 1948.55 |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
677f882d2ed8..133b.js gzip | 11.1 kB | 11.1 kB | |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-faae5f7..727a.js gzip | 7.22 kB | 7.22 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
Overall change | 58 kB | 58 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.9 kB | 6.93 kB | |
framework.HA..dule.js gzip | 39 kB | 39 kB | ✓ |
main-d2ce890..dule.js gzip | 6.28 kB | 6.28 kB | ✓ |
webpack-07c5..dule.js gzip | 751 B | 751 B | ✓ |
Overall change | 52.9 kB | 52.9 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
_app-9a0b9e1..b37e.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-ed1b0..8fbd.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-89731c..c609.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-409b283..e3ab.js gzip | 1.32 kB | 1.32 kB | ✓ |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
Overall change | 7.73 kB | 7.73 kB | ✓ |
Client Pages Modern
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
_app-75d3a82..dule.js gzip | 625 B | 625 B | ✓ |
_error-4469a..dule.js gzip | 2.29 kB | 2.29 kB | ✓ |
hooks-cbf13f..dule.js gzip | 387 B | 387 B | ✓ |
index-b9a643..dule.js gzip | 226 B | 226 B | ✓ |
link-92d3016..dule.js gzip | 1.28 kB | 1.28 kB | ✓ |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-f..dule.js gzip | 282 B | 282 B | ✓ |
Overall change | 5.37 kB | 5.37 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
_buildManifest.js gzip | 323 B | 323 B | ✓ |
_buildManife..dule.js gzip | 329 B | 329 B | ✓ |
Overall change | 652 B | 652 B | ✓ |
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
index.html gzip | 1 kB | 1 kB | -3 B |
link.html gzip | 1.01 kB | 1.01 kB | -1 B |
withRouter.html gzip | 995 B | 994 B | -1 B |
Overall change | 3.01 kB | 3 kB | -5 B |
Diffs
Diff for 677f882d2ed8..f527f314d.js
@@ -936,6 +936,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
var manualScrollRestoration = false && false;
+ var SSG_DATA_NOT_FOUND_ERROR = "SSG Data NOT_FOUND";
function fetchRetry(url, attempts) {
return fetch(url, {
@@ -957,6 +958,12 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
return fetchRetry(url, attempts - 1);
}
+ if (res.status === 404) {
+ // TODO: handle reloading in development from fallback returning 200
+ // to on-demand-entry-handler causing it to reload periodically
+ throw new Error(SSG_DATA_NOT_FOUND_ERROR);
+ }
+
throw new Error("Failed to load static props");
}
@@ -971,7 +978,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
// We should only trigger a server-side transition if this was caused
// on a client-side transition. Otherwise, we'd get into an infinite
// loop.
- if (!isServerRender) {
+ if (!isServerRender || err.message === "SSG Data NOT_FOUND") {
markLoadingError(err);
}
@@ -1668,7 +1675,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
case 2:
if (!(PAGE_LOAD_ERROR in err || loadErrorFail)) {
- _context2.next = 6;
+ _context2.next = 7;
break;
}
@@ -1678,17 +1685,20 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
// 3. Internal error while loading the page
// So, doing a hard reload is the proper way to deal with this.
+ if (false) {
+ }
+
window.location.href = as; // Changing the URL doesn't block executing the current code path.
// So let's throw a cancellation error stop the routing logic.
throw buildCancellationError();
- case 6:
- _context2.prev = 6;
- _context2.next = 9;
+ case 7:
+ _context2.prev = 7;
+ _context2.next = 10;
return this.fetchComponent("/_error");
- case 9:
+ case 10:
_yield$this$fetchComp = _context2.sent;
Component = _yield$this$fetchComp.page;
styleSheets = _yield$this$fetchComp.styleSheets;
@@ -1698,34 +1708,34 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
err: err,
error: err
};
- _context2.prev = 13;
- _context2.next = 16;
+ _context2.prev = 14;
+ _context2.next = 17;
return this.getInitialProps(Component, {
err: err,
pathname: pathname,
query: query
});
- case 16:
+ case 17:
routeInfo.props = _context2.sent;
- _context2.next = 23;
+ _context2.next = 24;
break;
- case 19:
- _context2.prev = 19;
- _context2.t0 = _context2["catch"](13);
+ case 20:
+ _context2.prev = 20;
+ _context2.t0 = _context2["catch"](14);
console.error(
"Error in error page `getInitialProps`: ",
_context2.t0
);
routeInfo.props = {};
- case 23:
+ case 24:
return _context2.abrupt("return", routeInfo);
- case 26:
- _context2.prev = 26;
- _context2.t1 = _context2["catch"](6);
+ case 27:
+ _context2.prev = 27;
+ _context2.t1 = _context2["catch"](7);
return _context2.abrupt(
"return",
this.handleRouteInfoError(
@@ -1737,7 +1747,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
)
);
- case 29:
+ case 30:
case "end":
return _context2.stop();
}
@@ -1746,8 +1756,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
_callee2,
this,
[
- [6, 26],
- [13, 19]
+ [7, 27],
+ [14, 20]
]
);
})
Diff for 677f882d2ed8..c9.module.js
@@ -792,6 +792,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
var manualScrollRestoration = false && false;
+ var SSG_DATA_NOT_FOUND_ERROR = "SSG Data NOT_FOUND";
function fetchRetry(url, attempts) {
return fetch(url, {
@@ -813,6 +814,12 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
return fetchRetry(url, attempts - 1);
}
+ if (res.status === 404) {
+ // TODO: handle reloading in development from fallback returning 200
+ // to on-demand-entry-handler causing it to reload periodically
+ throw new Error(SSG_DATA_NOT_FOUND_ERROR);
+ }
+
throw new Error("Failed to load static props");
}
@@ -825,7 +832,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
// We should only trigger a server-side transition if this was caused
// on a client-side transition. Otherwise, we'd get into an infinite
// loop.
- if (!isServerRender) {
+ if (!isServerRender || err.message === "SSG Data NOT_FOUND") {
markLoadingError(err);
}
@@ -1313,6 +1320,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
// 3. Internal error while loading the page
// So, doing a hard reload is the proper way to deal with this.
+ if (false) {
+ }
+
window.location.href = as; // Changing the URL doesn't block executing the current code path.
// So let's throw a cancellation error stop the routing logic.
Diff for index.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e790c6fbd72bc7c72cc9.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5af31c17fff173841a0d.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -121,13 +121,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.17d128b4c94f527f314d.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.457ce1b1de8547cd35a8.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e790c6fbd72bc7c72cc9.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5af31c17fff173841a0d.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for link.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e790c6fbd72bc7c72cc9.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5af31c17fff173841a0d.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -126,13 +126,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.17d128b4c94f527f314d.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.457ce1b1de8547cd35a8.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e790c6fbd72bc7c72cc9.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5af31c17fff173841a0d.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for withRouter.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e790c6fbd72bc7c72cc9.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5af31c17fff173841a0d.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -121,13 +121,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.17d128b4c94f527f314d.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.457ce1b1de8547cd35a8.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e790c6fbd72bc7c72cc9.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5af31c17fff173841a0d.module.js"
async=""
crossorigin="anonymous"
type="module"
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
buildDuration | 14.3s | 14.7s | |
nodeModulesSize | 63.4 MB | 63.4 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
677f882d2ed8..133b.js gzip | 11.1 kB | N/A | N/A |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-faae5f7..727a.js gzip | 7.22 kB | 7.22 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..98ff.js gzip | N/A | 11.1 kB | N/A |
Overall change | 58 kB | 58 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.9 kB | N/A | N/A |
framework.HA..dule.js gzip | 39 kB | 39 kB | ✓ |
main-d2ce890..dule.js gzip | 6.28 kB | 6.28 kB | ✓ |
webpack-07c5..dule.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..dule.js gzip | N/A | 6.93 kB | N/A |
Overall change | 52.9 kB | 52.9 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
_app-9a0b9e1..b37e.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-ed1b0..8fbd.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-89731c..c609.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-409b283..e3ab.js gzip | 1.32 kB | 1.32 kB | ✓ |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
Overall change | 7.73 kB | 7.73 kB | ✓ |
Client Pages Modern
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
_app-75d3a82..dule.js gzip | 625 B | 625 B | ✓ |
_error-4469a..dule.js gzip | 2.29 kB | 2.29 kB | ✓ |
hooks-cbf13f..dule.js gzip | 387 B | 387 B | ✓ |
index-b9a643..dule.js gzip | 226 B | 226 B | ✓ |
link-92d3016..dule.js gzip | 1.28 kB | 1.28 kB | ✓ |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-f..dule.js gzip | 282 B | 282 B | ✓ |
Overall change | 5.37 kB | 5.37 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
_buildManifest.js gzip | 323 B | 323 B | ✓ |
_buildManife..dule.js gzip | 329 B | 329 B | ✓ |
Overall change | 652 B | 652 B | ✓ |
Serverless bundles Overall increase ⚠️
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
_error.js | 1.05 MB | 1.05 MB | |
404.html | 4.34 kB | 4.34 kB | ✓ |
hooks.html | 3.92 kB | 3.92 kB | ✓ |
index.js | 1.05 MB | 1.05 MB | |
link.js | 1.1 MB | 1.1 MB | |
routerDirect.js | 1.09 MB | 1.1 MB | |
withRouter.js | 1.09 MB | 1.1 MB | |
Overall change | 5.41 MB | 5.41 MB |
kodiakhq bot
pushed a commit
that referenced
this pull request
Oct 12, 2020
While working on #17755 noticed a couple of cases that needed fixing and broke them out to this PR to make that one easier to review. One fix is for `ssgCacheKey` where it wasn't having the `locale` prefix stripped correctly due to the locales no longer being populated under the server instances `renderOpts` and the second fix is for the `asPath` not being set to `/` when the `locale` is the only part in the URL e.g. `/en` became an empty string `""` x-ref: #17370
Stats from current PRDefault Server Mode (Increase detected
|
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
buildDuration | 13.8s | 14.2s | |
nodeModulesSize | 63.4 MB | 63.4 MB |
Page Load Tests Overall decrease ⚠️
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.662 | 2.667 | 0 |
/ avg req/sec | 938.98 | 937.51 | |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.58 | 1.593 | |
/error-in-render avg req/sec | 1582.47 | 1569.51 |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
677f882d2ed8..133b.js gzip | 11.1 kB | 11.1 kB | |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-2540b2f..aa10.js gzip | 7.22 kB | 7.22 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
Overall change | 58 kB | 58 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.9 kB | 6.93 kB | |
framework.HA..dule.js gzip | 39 kB | 39 kB | ✓ |
main-0d1e0b8..dule.js gzip | 6.28 kB | 6.28 kB | ✓ |
webpack-07c5..dule.js gzip | 751 B | 751 B | ✓ |
Overall change | 52.9 kB | 52.9 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
_app-9a0b9e1..b37e.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-ed1b0..8fbd.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-89731c..c609.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-409b283..e3ab.js gzip | 1.32 kB | 1.32 kB | ✓ |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
Overall change | 7.73 kB | 7.73 kB | ✓ |
Client Pages Modern
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
_app-75d3a82..dule.js gzip | 625 B | 625 B | ✓ |
_error-4469a..dule.js gzip | 2.29 kB | 2.29 kB | ✓ |
hooks-cbf13f..dule.js gzip | 387 B | 387 B | ✓ |
index-b9a643..dule.js gzip | 226 B | 226 B | ✓ |
link-92d3016..dule.js gzip | 1.28 kB | 1.28 kB | ✓ |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-f..dule.js gzip | 282 B | 282 B | ✓ |
Overall change | 5.37 kB | 5.37 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
_buildManifest.js gzip | 323 B | 323 B | ✓ |
_buildManife..dule.js gzip | 329 B | 329 B | ✓ |
Overall change | 652 B | 652 B | ✓ |
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
index.html gzip | 1 kB | 1 kB | -2 B |
link.html gzip | 1.01 kB | 1.01 kB | -1 B |
withRouter.html gzip | 996 B | 994 B | -2 B |
Overall change | 3.01 kB | 3.01 kB | -5 B |
Diffs
Diff for 677f882d2ed8..f527f314d.js
@@ -936,6 +936,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
var manualScrollRestoration = false && false;
+ var SSG_DATA_NOT_FOUND_ERROR = "SSG Data NOT_FOUND";
function fetchRetry(url, attempts) {
return fetch(url, {
@@ -957,6 +958,12 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
return fetchRetry(url, attempts - 1);
}
+ if (res.status === 404) {
+ // TODO: handle reloading in development from fallback returning 200
+ // to on-demand-entry-handler causing it to reload periodically
+ throw new Error(SSG_DATA_NOT_FOUND_ERROR);
+ }
+
throw new Error("Failed to load static props");
}
@@ -971,7 +978,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
// We should only trigger a server-side transition if this was caused
// on a client-side transition. Otherwise, we'd get into an infinite
// loop.
- if (!isServerRender) {
+ if (!isServerRender || err.message === "SSG Data NOT_FOUND") {
markLoadingError(err);
}
@@ -1668,7 +1675,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
case 2:
if (!(PAGE_LOAD_ERROR in err || loadErrorFail)) {
- _context2.next = 6;
+ _context2.next = 7;
break;
}
@@ -1678,17 +1685,20 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
// 3. Internal error while loading the page
// So, doing a hard reload is the proper way to deal with this.
+ if (false) {
+ }
+
window.location.href = as; // Changing the URL doesn't block executing the current code path.
// So let's throw a cancellation error stop the routing logic.
throw buildCancellationError();
- case 6:
- _context2.prev = 6;
- _context2.next = 9;
+ case 7:
+ _context2.prev = 7;
+ _context2.next = 10;
return this.fetchComponent("/_error");
- case 9:
+ case 10:
_yield$this$fetchComp = _context2.sent;
Component = _yield$this$fetchComp.page;
styleSheets = _yield$this$fetchComp.styleSheets;
@@ -1698,34 +1708,34 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
err: err,
error: err
};
- _context2.prev = 13;
- _context2.next = 16;
+ _context2.prev = 14;
+ _context2.next = 17;
return this.getInitialProps(Component, {
err: err,
pathname: pathname,
query: query
});
- case 16:
+ case 17:
routeInfo.props = _context2.sent;
- _context2.next = 23;
+ _context2.next = 24;
break;
- case 19:
- _context2.prev = 19;
- _context2.t0 = _context2["catch"](13);
+ case 20:
+ _context2.prev = 20;
+ _context2.t0 = _context2["catch"](14);
console.error(
"Error in error page `getInitialProps`: ",
_context2.t0
);
routeInfo.props = {};
- case 23:
+ case 24:
return _context2.abrupt("return", routeInfo);
- case 26:
- _context2.prev = 26;
- _context2.t1 = _context2["catch"](6);
+ case 27:
+ _context2.prev = 27;
+ _context2.t1 = _context2["catch"](7);
return _context2.abrupt(
"return",
this.handleRouteInfoError(
@@ -1737,7 +1747,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
)
);
- case 29:
+ case 30:
case "end":
return _context2.stop();
}
@@ -1746,8 +1756,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
_callee2,
this,
[
- [6, 26],
- [13, 19]
+ [7, 27],
+ [14, 20]
]
);
})
Diff for 677f882d2ed8..c9.module.js
@@ -792,6 +792,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
var manualScrollRestoration = false && false;
+ var SSG_DATA_NOT_FOUND_ERROR = "SSG Data NOT_FOUND";
function fetchRetry(url, attempts) {
return fetch(url, {
@@ -813,6 +814,12 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
return fetchRetry(url, attempts - 1);
}
+ if (res.status === 404) {
+ // TODO: handle reloading in development from fallback returning 200
+ // to on-demand-entry-handler causing it to reload periodically
+ throw new Error(SSG_DATA_NOT_FOUND_ERROR);
+ }
+
throw new Error("Failed to load static props");
}
@@ -825,7 +832,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
// We should only trigger a server-side transition if this was caused
// on a client-side transition. Otherwise, we'd get into an infinite
// loop.
- if (!isServerRender) {
+ if (!isServerRender || err.message === "SSG Data NOT_FOUND") {
markLoadingError(err);
}
@@ -1313,6 +1320,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
// 3. Internal error while loading the page
// So, doing a hard reload is the proper way to deal with this.
+ if (false) {
+ }
+
window.location.href = as; // Changing the URL doesn't block executing the current code path.
// So let's throw a cancellation error stop the routing logic.
Diff for index.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e790c6fbd72bc7c72cc9.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5af31c17fff173841a0d.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -121,13 +121,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.17d128b4c94f527f314d.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.457ce1b1de8547cd35a8.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e790c6fbd72bc7c72cc9.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5af31c17fff173841a0d.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for link.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e790c6fbd72bc7c72cc9.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5af31c17fff173841a0d.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -126,13 +126,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.17d128b4c94f527f314d.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.457ce1b1de8547cd35a8.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e790c6fbd72bc7c72cc9.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5af31c17fff173841a0d.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for withRouter.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e790c6fbd72bc7c72cc9.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5af31c17fff173841a0d.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -121,13 +121,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.17d128b4c94f527f314d.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.457ce1b1de8547cd35a8.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e790c6fbd72bc7c72cc9.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5af31c17fff173841a0d.module.js"
async=""
crossorigin="anonymous"
type="module"
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
buildDuration | 15.8s | 15.3s | -497ms |
nodeModulesSize | 63.4 MB | 63.4 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
677f882d2ed8..133b.js gzip | 11.1 kB | N/A | N/A |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-2540b2f..aa10.js gzip | 7.22 kB | 7.22 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..98ff.js gzip | N/A | 11.1 kB | N/A |
Overall change | 58 kB | 58 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.9 kB | N/A | N/A |
framework.HA..dule.js gzip | 39 kB | 39 kB | ✓ |
main-0d1e0b8..dule.js gzip | 6.28 kB | 6.28 kB | ✓ |
webpack-07c5..dule.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..dule.js gzip | N/A | 6.93 kB | N/A |
Overall change | 52.9 kB | 52.9 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
_app-9a0b9e1..b37e.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-ed1b0..8fbd.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-89731c..c609.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-409b283..e3ab.js gzip | 1.32 kB | 1.32 kB | ✓ |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
Overall change | 7.73 kB | 7.73 kB | ✓ |
Client Pages Modern
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
_app-75d3a82..dule.js gzip | 625 B | 625 B | ✓ |
_error-4469a..dule.js gzip | 2.29 kB | 2.29 kB | ✓ |
hooks-cbf13f..dule.js gzip | 387 B | 387 B | ✓ |
index-b9a643..dule.js gzip | 226 B | 226 B | ✓ |
link-92d3016..dule.js gzip | 1.28 kB | 1.28 kB | ✓ |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-f..dule.js gzip | 282 B | 282 B | ✓ |
Overall change | 5.37 kB | 5.37 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
_buildManifest.js gzip | 323 B | 323 B | ✓ |
_buildManife..dule.js gzip | 329 B | 329 B | ✓ |
Overall change | 652 B | 652 B | ✓ |
Serverless bundles Overall increase ⚠️
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
_error.js | 1.05 MB | 1.05 MB | |
404.html | 4.34 kB | 4.34 kB | ✓ |
hooks.html | 3.92 kB | 3.92 kB | ✓ |
index.js | 1.05 MB | 1.05 MB | |
link.js | 1.1 MB | 1.1 MB | |
routerDirect.js | 1.09 MB | 1.1 MB | |
withRouter.js | 1.09 MB | 1.1 MB | |
Overall change | 5.41 MB | 5.41 MB |
timneutkens
previously approved these changes
Oct 14, 2020
# Conflicts: # packages/next/next-server/server/render.tsx
Stats from current PRDefault Server Mode (Increase detected
|
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
buildDuration | 13.9s | 13.6s | -307ms |
nodeModulesSize | 63.4 MB | 63.4 MB |
Page Load Tests Overall decrease ⚠️
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.607 | 2.801 | |
/ avg req/sec | 958.84 | 892.56 | |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.544 | 1.618 | |
/error-in-render avg req/sec | 1618.98 | 1545.34 |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
677f882d2ed8..133b.js gzip | 11.1 kB | 11.1 kB | |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-3fae807..efe0.js gzip | 7.3 kB | 7.3 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
Overall change | 58.1 kB | 58.1 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.9 kB | 6.93 kB | |
framework.HA..dule.js gzip | 39 kB | 39 kB | ✓ |
main-8ac5189..dule.js gzip | 6.29 kB | 6.29 kB | ✓ |
webpack-07c5..dule.js gzip | 751 B | 751 B | ✓ |
Overall change | 52.9 kB | 52.9 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
_app-9a0b9e1..b37e.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-ed1b0..8fbd.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-89731c..c609.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-409b283..e3ab.js gzip | 1.32 kB | 1.32 kB | ✓ |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
Overall change | 7.73 kB | 7.73 kB | ✓ |
Client Pages Modern
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
_app-75d3a82..dule.js gzip | 625 B | 625 B | ✓ |
_error-4469a..dule.js gzip | 2.29 kB | 2.29 kB | ✓ |
hooks-cbf13f..dule.js gzip | 387 B | 387 B | ✓ |
index-b9a643..dule.js gzip | 226 B | 226 B | ✓ |
link-92d3016..dule.js gzip | 1.28 kB | 1.28 kB | ✓ |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-f..dule.js gzip | 282 B | 282 B | ✓ |
Overall change | 5.37 kB | 5.37 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
_buildManifest.js gzip | 323 B | 323 B | ✓ |
_buildManife..dule.js gzip | 329 B | 329 B | ✓ |
Overall change | 652 B | 652 B | ✓ |
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
index.html gzip | 1 kB | 1 kB | -2 B |
link.html gzip | 1.01 kB | 1.01 kB | -2 B |
withRouter.html gzip | 995 B | 994 B | -1 B |
Overall change | 3.01 kB | 3 kB | -5 B |
Diffs
Diff for 677f882d2ed8..f527f314d.js
@@ -936,6 +936,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
var manualScrollRestoration = false && false;
+ var SSG_DATA_NOT_FOUND_ERROR = "SSG Data NOT_FOUND";
function fetchRetry(url, attempts) {
return fetch(url, {
@@ -957,6 +958,12 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
return fetchRetry(url, attempts - 1);
}
+ if (res.status === 404) {
+ // TODO: handle reloading in development from fallback returning 200
+ // to on-demand-entry-handler causing it to reload periodically
+ throw new Error(SSG_DATA_NOT_FOUND_ERROR);
+ }
+
throw new Error("Failed to load static props");
}
@@ -971,7 +978,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
// We should only trigger a server-side transition if this was caused
// on a client-side transition. Otherwise, we'd get into an infinite
// loop.
- if (!isServerRender) {
+ if (!isServerRender || err.message === "SSG Data NOT_FOUND") {
markLoadingError(err);
}
@@ -1668,7 +1675,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
case 2:
if (!(PAGE_LOAD_ERROR in err || loadErrorFail)) {
- _context2.next = 6;
+ _context2.next = 7;
break;
}
@@ -1678,17 +1685,20 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
// 3. Internal error while loading the page
// So, doing a hard reload is the proper way to deal with this.
+ if (false) {
+ }
+
window.location.href = as; // Changing the URL doesn't block executing the current code path.
// So let's throw a cancellation error stop the routing logic.
throw buildCancellationError();
- case 6:
- _context2.prev = 6;
- _context2.next = 9;
+ case 7:
+ _context2.prev = 7;
+ _context2.next = 10;
return this.fetchComponent("/_error");
- case 9:
+ case 10:
_yield$this$fetchComp = _context2.sent;
Component = _yield$this$fetchComp.page;
styleSheets = _yield$this$fetchComp.styleSheets;
@@ -1698,34 +1708,34 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
err: err,
error: err
};
- _context2.prev = 13;
- _context2.next = 16;
+ _context2.prev = 14;
+ _context2.next = 17;
return this.getInitialProps(Component, {
err: err,
pathname: pathname,
query: query
});
- case 16:
+ case 17:
routeInfo.props = _context2.sent;
- _context2.next = 23;
+ _context2.next = 24;
break;
- case 19:
- _context2.prev = 19;
- _context2.t0 = _context2["catch"](13);
+ case 20:
+ _context2.prev = 20;
+ _context2.t0 = _context2["catch"](14);
console.error(
"Error in error page `getInitialProps`: ",
_context2.t0
);
routeInfo.props = {};
- case 23:
+ case 24:
return _context2.abrupt("return", routeInfo);
- case 26:
- _context2.prev = 26;
- _context2.t1 = _context2["catch"](6);
+ case 27:
+ _context2.prev = 27;
+ _context2.t1 = _context2["catch"](7);
return _context2.abrupt(
"return",
this.handleRouteInfoError(
@@ -1737,7 +1747,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
)
);
- case 29:
+ case 30:
case "end":
return _context2.stop();
}
@@ -1746,8 +1756,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
_callee2,
this,
[
- [6, 26],
- [13, 19]
+ [7, 27],
+ [14, 20]
]
);
})
Diff for 677f882d2ed8..c9.module.js
@@ -792,6 +792,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
var manualScrollRestoration = false && false;
+ var SSG_DATA_NOT_FOUND_ERROR = "SSG Data NOT_FOUND";
function fetchRetry(url, attempts) {
return fetch(url, {
@@ -813,6 +814,12 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
return fetchRetry(url, attempts - 1);
}
+ if (res.status === 404) {
+ // TODO: handle reloading in development from fallback returning 200
+ // to on-demand-entry-handler causing it to reload periodically
+ throw new Error(SSG_DATA_NOT_FOUND_ERROR);
+ }
+
throw new Error("Failed to load static props");
}
@@ -825,7 +832,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
// We should only trigger a server-side transition if this was caused
// on a client-side transition. Otherwise, we'd get into an infinite
// loop.
- if (!isServerRender) {
+ if (!isServerRender || err.message === "SSG Data NOT_FOUND") {
markLoadingError(err);
}
@@ -1313,6 +1320,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
// 3. Internal error while loading the page
// So, doing a hard reload is the proper way to deal with this.
+ if (false) {
+ }
+
window.location.href = as; // Changing the URL doesn't block executing the current code path.
// So let's throw a cancellation error stop the routing logic.
Diff for index.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e790c6fbd72bc7c72cc9.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5af31c17fff173841a0d.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -121,13 +121,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.17d128b4c94f527f314d.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.457ce1b1de8547cd35a8.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e790c6fbd72bc7c72cc9.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5af31c17fff173841a0d.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for link.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e790c6fbd72bc7c72cc9.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5af31c17fff173841a0d.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -126,13 +126,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.17d128b4c94f527f314d.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.457ce1b1de8547cd35a8.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e790c6fbd72bc7c72cc9.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5af31c17fff173841a0d.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for withRouter.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e790c6fbd72bc7c72cc9.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5af31c17fff173841a0d.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -121,13 +121,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.17d128b4c94f527f314d.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.457ce1b1de8547cd35a8.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e790c6fbd72bc7c72cc9.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5af31c17fff173841a0d.module.js"
async=""
crossorigin="anonymous"
type="module"
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
buildDuration | 15.7s | 15.6s | -163ms |
nodeModulesSize | 63.4 MB | 63.4 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
677f882d2ed8..133b.js gzip | 11.1 kB | N/A | N/A |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-3fae807..efe0.js gzip | 7.3 kB | 7.3 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..98ff.js gzip | N/A | 11.1 kB | N/A |
Overall change | 58.1 kB | 58.1 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.9 kB | N/A | N/A |
framework.HA..dule.js gzip | 39 kB | 39 kB | ✓ |
main-8ac5189..dule.js gzip | 6.29 kB | 6.29 kB | ✓ |
webpack-07c5..dule.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..dule.js gzip | N/A | 6.93 kB | N/A |
Overall change | 52.9 kB | 52.9 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
_app-9a0b9e1..b37e.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-ed1b0..8fbd.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-89731c..c609.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-409b283..e3ab.js gzip | 1.32 kB | 1.32 kB | ✓ |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
Overall change | 7.73 kB | 7.73 kB | ✓ |
Client Pages Modern
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
_app-75d3a82..dule.js gzip | 625 B | 625 B | ✓ |
_error-4469a..dule.js gzip | 2.29 kB | 2.29 kB | ✓ |
hooks-cbf13f..dule.js gzip | 387 B | 387 B | ✓ |
index-b9a643..dule.js gzip | 226 B | 226 B | ✓ |
link-92d3016..dule.js gzip | 1.28 kB | 1.28 kB | ✓ |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-f..dule.js gzip | 282 B | 282 B | ✓ |
Overall change | 5.37 kB | 5.37 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
_buildManifest.js gzip | 323 B | 323 B | ✓ |
_buildManife..dule.js gzip | 329 B | 329 B | ✓ |
Overall change | 652 B | 652 B | ✓ |
Serverless bundles Overall increase ⚠️
vercel/next.js canary | ijjk/next.js ssg/return-404 | Change | |
---|---|---|---|
_error.js | 1.06 MB | 1.06 MB | |
404.html | 4.34 kB | 4.34 kB | ✓ |
hooks.html | 3.92 kB | 3.92 kB | ✓ |
index.js | 1.06 MB | 1.06 MB | |
link.js | 1.1 MB | 1.1 MB | |
routerDirect.js | 1.1 MB | 1.1 MB | |
withRouter.js | 1.1 MB | 1.1 MB | |
Overall change | 5.41 MB | 5.41 MB |
timneutkens
approved these changes
Oct 15, 2020
Good job! Do you plan to add |
Yeah eventually that's the plan. |
This was referenced Oct 25, 2020
kodiakhq bot
pushed a commit
that referenced
this pull request
Oct 27, 2020
This is a follow-up to #17755 which adds support for returning `notFound` to `getServerSideProps` also
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds support for returning
notFound: true
fromgetStaticProps
which ties into #17370 by allowing non-dynamic SSG pages to opt-out of rendering certain locales sincegetStaticProps
is called with all locales for non-dynamic SSG pages.This will also allow
fallback: true
pages to prevent generating extra pages when handling the404
status.