Skip to content
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

Fall back to default components when a top-level error occurs #24079

Merged
merged 3 commits into from
Apr 15, 2021

Conversation

ijjk
Copy link
Member

@ijjk ijjk commented Apr 15, 2021

This fixes an internal server error showing when a top-level error occurs in _app in development instead of the dev overlay. This includes the failing test case from #24069 and also ensures the overlay is cleared when the error is corrected.

Bug

  • Related issues linked using fixes #number
  • Integration tests added

Fixes: #24070
Closes: #24069

@ijjk

This comment has been minimized.

@ijjk

This comment has been minimized.

@ijjk
Copy link
Member Author

ijjk commented Apr 15, 2021

Stats from current PR

Default Server Mode (Decrease detected ✓)
General Overall increase ⚠️
vercel/next.js canary ijjk/next.js fix/top-level-app Change
buildDuration 15.1s 15.5s ⚠️ +369ms
nodeModulesSize 46.2 MB 46.2 MB ⚠️ +2.85 kB
Page Load Tests Overall decrease ⚠️
vercel/next.js canary ijjk/next.js fix/top-level-app Change
/ failed reqs 0 0
/ total time (seconds) 2.541 2.696 ⚠️ +0.16
/ avg req/sec 983.82 927.2 ⚠️ -56.62
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.433 1.429 0
/error-in-render avg req/sec 1744.32 1749.62 +5.3
Client Bundles (main, webpack, commons)
vercel/next.js canary ijjk/next.js fix/top-level-app Change
597-3f457946..288d.js gzip 13.3 kB 13.3 kB
778-9c11a899..1178.js gzip 7.05 kB 7.05 kB
framework.HASH.js gzip 39.3 kB 39.3 kB
main-HASH.js gzip 151 B 151 B
webpack-HASH.js gzip 993 B 993 B
Overall change 60.8 kB 60.8 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary ijjk/next.js fix/top-level-app Change
polyfills-HASH.js gzip 31.1 kB 31.1 kB
Overall change 31.1 kB 31.1 kB
Client Pages
vercel/next.js canary ijjk/next.js fix/top-level-app Change
_app-5cc66b2..6f03.js gzip 1.3 kB 1.3 kB
_error-55112..054d.js gzip 3.68 kB 3.68 kB
amp-89a5460c..567f.js gzip 558 B 558 B
hooks-8c2e74..be37.js gzip 924 B 924 B
index-fec729..83b2.js gzip 243 B 243 B
link-dd34d9b..0ade.js gzip 1.66 kB 1.66 kB
routerDirect..5759.js gzip 336 B 336 B
withRouter-1..98bf.js gzip 334 B 334 B
Overall change 9.03 kB 9.03 kB
Client Build Manifests
vercel/next.js canary ijjk/next.js fix/top-level-app Change
_buildManifest.js gzip 349 B 349 B
Overall change 349 B 349 B
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary ijjk/next.js fix/top-level-app Change
index.html gzip 609 B 609 B
link.html gzip 616 B 615 B -1 B
withRouter.html gzip 605 B 603 B -2 B
Overall change 1.83 kB 1.83 kB -3 B

Diffs

Diff for main-HASH.js
@@ -601,10 +601,10 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
         var _ref3 = _asyncToGenerator(
           /*#__PURE__*/ _regeneratorRuntime.mark(function _callee() {
             var opts,
+              initialErr,
               appEntrypoint,
               app,
               mod,
-              initialErr,
               pageEntrypoint,
               _require7,
               isValidElementType,
@@ -627,20 +627,22 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
                       if (false) {
                       }
 
-                      _context.next = 4;
+                      initialErr = hydrateErr;
+                      _context.prev = 3;
+                      _context.next = 6;
                       return pageLoader.routeLoader.whenEntrypoint("/_app");
 
-                    case 4:
+                    case 6:
                       appEntrypoint = _context.sent;
 
                       if (!("error" in appEntrypoint)) {
-                        _context.next = 7;
+                        _context.next = 9;
                         break;
                       }
 
                       throw appEntrypoint.error;
 
-                    case 7:
+                    case 9:
                       (app = appEntrypoint.component),
                         (mod = appEntrypoint.exports);
                       CachedApp = app;
@@ -679,9 +681,6 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
                         };
                       }
 
-                      initialErr = hydrateErr;
-                      _context.prev = 11;
-
                       if (true) {
                         _context.next = 16;
                         break;
@@ -745,7 +744,7 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
 
                     case 29:
                       _context.prev = 29;
-                      _context.t1 = _context["catch"](11);
+                      _context.t1 = _context["catch"](3);
                       // This catches errors like throwing in the top level of a module
                       initialErr = _context.t1;
 
@@ -826,7 +825,7 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
               },
               _callee,
               null,
-              [[11, 29]]
+              [[3, 29]]
             );
           })
         );
Diff for index.html
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/main-e495f9ee147cf2c28307.js"
+      href="/_next/static/chunks/main-02667db6a7ce35d873bc.js"
       as="script"
     />
     <link
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/main-e495f9ee147cf2c28307.js"
+      src="/_next/static/chunks/main-02667db6a7ce35d873bc.js"
       async=""
     ></script>
     <script
Diff for link.html
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/main-e495f9ee147cf2c28307.js"
+      href="/_next/static/chunks/main-02667db6a7ce35d873bc.js"
       as="script"
     />
     <link
@@ -70,7 +70,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/main-e495f9ee147cf2c28307.js"
+      src="/_next/static/chunks/main-02667db6a7ce35d873bc.js"
       async=""
     ></script>
     <script
Diff for withRouter.html
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/main-e495f9ee147cf2c28307.js"
+      href="/_next/static/chunks/main-02667db6a7ce35d873bc.js"
       as="script"
     />
     <link
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/main-e495f9ee147cf2c28307.js"
+      src="/_next/static/chunks/main-02667db6a7ce35d873bc.js"
       async=""
     ></script>
     <script

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary ijjk/next.js fix/top-level-app Change
buildDuration 19.6s 20.8s ⚠️ +1.2s
nodeModulesSize 46.2 MB 46.2 MB ⚠️ +2.85 kB
Client Bundles (main, webpack, commons)
vercel/next.js canary ijjk/next.js fix/top-level-app Change
597-3f457946..288d.js gzip 13.3 kB 13.3 kB
778-9c11a899..1178.js gzip 7.05 kB N/A N/A
framework.HASH.js gzip 39.3 kB 39.3 kB
main-HASH.js gzip 151 B 151 B
webpack-HASH.js gzip 993 B 993 B
778-bfe2f654..5720.js gzip N/A 7.05 kB N/A
Overall change 60.8 kB 60.8 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary ijjk/next.js fix/top-level-app Change
polyfills-HASH.js gzip 31.1 kB 31.1 kB
Overall change 31.1 kB 31.1 kB
Client Pages
vercel/next.js canary ijjk/next.js fix/top-level-app Change
_app-5cc66b2..6f03.js gzip 1.3 kB 1.3 kB
_error-55112..054d.js gzip 3.68 kB 3.68 kB
amp-89a5460c..567f.js gzip 558 B 558 B
hooks-8c2e74..be37.js gzip 924 B 924 B
index-fec729..83b2.js gzip 243 B 243 B
link-dd34d9b..0ade.js gzip 1.66 kB 1.66 kB
routerDirect..5759.js gzip 336 B 336 B
withRouter-1..98bf.js gzip 334 B 334 B
Overall change 9.03 kB 9.03 kB
Client Build Manifests
vercel/next.js canary ijjk/next.js fix/top-level-app Change
_buildManifest.js gzip 349 B 349 B
Overall change 349 B 349 B
Serverless bundles Overall increase ⚠️
vercel/next.js canary ijjk/next.js fix/top-level-app Change
_error.js 1.39 MB 1.39 MB ⚠️ +555 B
404.html 2.76 kB 2.76 kB
500.html 2.75 kB 2.75 kB
amp.amp.html 10.7 kB 10.7 kB
amp.html 1.96 kB 1.96 kB
hooks.html 2.01 kB 2.01 kB
index.js 1.39 MB 1.39 MB ⚠️ +555 B
link.js 1.45 MB 1.45 MB ⚠️ +555 B
routerDirect.js 1.44 MB 1.44 MB ⚠️ +555 B
withRouter.js 1.44 MB 1.44 MB ⚠️ +557 B
Overall change 7.14 MB 7.14 MB ⚠️ +2.78 kB

Webpack 5 Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary ijjk/next.js fix/top-level-app Change
buildDuration 15.3s 16.8s ⚠️ +1.5s
nodeModulesSize 46.2 MB 46.2 MB ⚠️ +2.85 kB
Page Load Tests Overall increase ✓
vercel/next.js canary ijjk/next.js fix/top-level-app Change
/ failed reqs 0 0
/ total time (seconds) 2.887 2.929 ⚠️ +0.04
/ avg req/sec 865.99 853.6 ⚠️ -12.39
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.664 1.622 -0.04
/error-in-render avg req/sec 1502.49 1541.37 +38.88
Client Bundles (main, webpack, commons)
vercel/next.js canary ijjk/next.js fix/top-level-app Change
597-3f457946..288d.js gzip 13.3 kB 13.3 kB
778-9c11a899..1178.js gzip 7.05 kB 7.05 kB
framework.HASH.js gzip 39.3 kB 39.3 kB
main-HASH.js gzip 151 B 151 B
webpack-HASH.js gzip 993 B 993 B
Overall change 60.8 kB 60.8 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary ijjk/next.js fix/top-level-app Change
polyfills-HASH.js gzip 31.1 kB 31.1 kB
Overall change 31.1 kB 31.1 kB
Client Pages
vercel/next.js canary ijjk/next.js fix/top-level-app Change
_app-5cc66b2..6f03.js gzip 1.3 kB 1.3 kB
_error-55112..054d.js gzip 3.68 kB 3.68 kB
amp-89a5460c..567f.js gzip 558 B 558 B
hooks-8c2e74..be37.js gzip 924 B 924 B
index-fec729..83b2.js gzip 243 B 243 B
link-dd34d9b..0ade.js gzip 1.66 kB 1.66 kB
routerDirect..5759.js gzip 336 B 336 B
withRouter-1..98bf.js gzip 334 B 334 B
Overall change 9.03 kB 9.03 kB
Client Build Manifests
vercel/next.js canary ijjk/next.js fix/top-level-app Change
_buildManifest.js gzip 349 B 349 B
Overall change 349 B 349 B
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary ijjk/next.js fix/top-level-app Change
index.html gzip 609 B 609 B
link.html gzip 616 B 615 B -1 B
withRouter.html gzip 605 B 603 B -2 B
Overall change 1.83 kB 1.83 kB -3 B

Diffs

Diff for 778-9c11a899..337771178.js
@@ -400,27 +400,29 @@
                     case 0:
                       return (
                         s.length > 0 && void 0 !== s[0] ? s[0] : {},
-                        (e.next = 4),
+                        (r = F),
+                        (e.prev = 3),
+                        (e.next = 6),
                         Q.routeLoader.whenEntrypoint("/_app")
                       );
-                    case 4:
-                      if (!("error" in (r = e.sent))) {
-                        e.next = 7;
+                    case 6:
+                      if (!("error" in (o = e.sent))) {
+                        e.next = 9;
                         break;
                       }
-                      throw r.error;
-                    case 7:
-                      (o = r.component),
-                        (a = r.exports),
-                        (Z = o),
-                        a &&
-                          a.reportWebVitals &&
+                      throw o.error;
+                    case 9:
+                      (a = o.component),
+                        (i = o.exports),
+                        (Z = a),
+                        i &&
+                          i.reportWebVitals &&
                           (ee = function(e) {
                             var t,
                               r = e.id,
                               n = e.name,
                               o = e.startTime,
-                              i = e.value,
+                              a = e.value,
                               u = e.duration,
                               c = e.entryType,
                               s = e.entries,
@@ -431,19 +433,17 @@
                                     1e12
                                 );
                             s && s.length && (t = s[0].startTime),
-                              a.reportWebVitals({
+                              i.reportWebVitals({
                                 id: r || l,
                                 name: n,
                                 startTime: o || t,
-                                value: null == i ? u : i,
+                                value: null == a ? u : a,
                                 label:
                                   "mark" === c || "measure" === c
                                     ? "custom"
                                     : "web-vital"
                               });
                           }),
-                        (i = F),
-                        (e.prev = 11),
                         (e.next = 16);
                       break;
                     case 16:
@@ -463,7 +463,7 @@
                       e.next = 32;
                       break;
                     case 29:
-                      (e.prev = 29), (e.t1 = e.catch(11)), (i = e.t1);
+                      (e.prev = 29), (e.t1 = e.catch(3)), (r = e.t1);
                     case 32:
                       if (!window.__NEXT_PRELOADREADY) {
                         e.next = 36;
@@ -478,7 +478,7 @@
                           App: Z,
                           Component: ne,
                           wrapApp: ve,
-                          err: i,
+                          err: r,
                           isFallback: Boolean(H),
                           subscription: function(e, t, r) {
                             return ue(
@@ -497,7 +497,7 @@
                             initial: !0,
                             Component: ne,
                             props: L,
-                            err: i
+                            err: r
                           })
                         ),
                         e.abrupt("return", ae)
@@ -515,7 +515,7 @@
               },
               e,
               null,
-              [[11, 29]]
+              [[3, 29]]
             );
           })
         );
Diff for index.html
@@ -7,7 +7,7 @@
     <noscript data-n-css=""></noscript>
     <link
       rel="preload"
-      href="/_next/static/chunks/webpack-0b22b91dc4c1318b0aae.js"
+      href="/_next/static/chunks/webpack-ada63f0bc4b3f0933210.js"
       as="script"
     />
     <link
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/778-9c11a89976b337771178.js"
+      href="/_next/static/chunks/778-bfe2f6545b0bec9e5720.js"
       as="script"
     />
     <link
@@ -48,7 +48,7 @@
         "props": { "pageProps": {} },
         "page": "/",
         "query": {},
-        "buildId": "oXgInwUCDXMkgHEU6-p4X",
+        "buildId": "GMZFi2uqGsBnsZwytuz_Q",
         "isFallback": false,
         "gip": true
       }
@@ -58,7 +58,7 @@
       src="/_next/static/chunks/polyfills-8683bd742a84c1edd48c.js"
     ></script>
     <script
-      src="/_next/static/chunks/webpack-0b22b91dc4c1318b0aae.js"
+      src="/_next/static/chunks/webpack-ada63f0bc4b3f0933210.js"
       async=""
     ></script>
     <script
@@ -70,7 +70,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/778-9c11a89976b337771178.js"
+      src="/_next/static/chunks/778-bfe2f6545b0bec9e5720.js"
       async=""
     ></script>
     <script
@@ -86,11 +86,11 @@
       async=""
     ></script>
     <script
-      src="/_next/static/oXgInwUCDXMkgHEU6-p4X/_buildManifest.js"
+      src="/_next/static/GMZFi2uqGsBnsZwytuz_Q/_buildManifest.js"
       async=""
     ></script>
     <script
-      src="/_next/static/oXgInwUCDXMkgHEU6-p4X/_ssgManifest.js"
+      src="/_next/static/GMZFi2uqGsBnsZwytuz_Q/_ssgManifest.js"
       async=""
     ></script>
   </body>
Diff for link.html
@@ -7,7 +7,7 @@
     <noscript data-n-css=""></noscript>
     <link
       rel="preload"
-      href="/_next/static/chunks/webpack-0b22b91dc4c1318b0aae.js"
+      href="/_next/static/chunks/webpack-ada63f0bc4b3f0933210.js"
       as="script"
     />
     <link
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/778-9c11a89976b337771178.js"
+      href="/_next/static/chunks/778-bfe2f6545b0bec9e5720.js"
       as="script"
     />
     <link
@@ -53,7 +53,7 @@
         "props": { "pageProps": {} },
         "page": "/link",
         "query": {},
-        "buildId": "oXgInwUCDXMkgHEU6-p4X",
+        "buildId": "GMZFi2uqGsBnsZwytuz_Q",
         "isFallback": false,
         "gip": true
       }
@@ -63,7 +63,7 @@
       src="/_next/static/chunks/polyfills-8683bd742a84c1edd48c.js"
     ></script>
     <script
-      src="/_next/static/chunks/webpack-0b22b91dc4c1318b0aae.js"
+      src="/_next/static/chunks/webpack-ada63f0bc4b3f0933210.js"
       async=""
     ></script>
     <script
@@ -75,7 +75,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/778-9c11a89976b337771178.js"
+      src="/_next/static/chunks/778-bfe2f6545b0bec9e5720.js"
       async=""
     ></script>
     <script
@@ -91,11 +91,11 @@
       async=""
     ></script>
     <script
-      src="/_next/static/oXgInwUCDXMkgHEU6-p4X/_buildManifest.js"
+      src="/_next/static/GMZFi2uqGsBnsZwytuz_Q/_buildManifest.js"
       async=""
     ></script>
     <script
-      src="/_next/static/oXgInwUCDXMkgHEU6-p4X/_ssgManifest.js"
+      src="/_next/static/GMZFi2uqGsBnsZwytuz_Q/_ssgManifest.js"
       async=""
     ></script>
   </body>
Diff for withRouter.html
@@ -7,7 +7,7 @@
     <noscript data-n-css=""></noscript>
     <link
       rel="preload"
-      href="/_next/static/chunks/webpack-0b22b91dc4c1318b0aae.js"
+      href="/_next/static/chunks/webpack-ada63f0bc4b3f0933210.js"
       as="script"
     />
     <link
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/778-9c11a89976b337771178.js"
+      href="/_next/static/chunks/778-bfe2f6545b0bec9e5720.js"
       as="script"
     />
     <link
@@ -48,7 +48,7 @@
         "props": { "pageProps": {} },
         "page": "/withRouter",
         "query": {},
-        "buildId": "oXgInwUCDXMkgHEU6-p4X",
+        "buildId": "GMZFi2uqGsBnsZwytuz_Q",
         "isFallback": false,
         "gip": true
       }
@@ -58,7 +58,7 @@
       src="/_next/static/chunks/polyfills-8683bd742a84c1edd48c.js"
     ></script>
     <script
-      src="/_next/static/chunks/webpack-0b22b91dc4c1318b0aae.js"
+      src="/_next/static/chunks/webpack-ada63f0bc4b3f0933210.js"
       async=""
     ></script>
     <script
@@ -70,7 +70,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/778-9c11a89976b337771178.js"
+      src="/_next/static/chunks/778-bfe2f6545b0bec9e5720.js"
       async=""
     ></script>
     <script
@@ -86,11 +86,11 @@
       async=""
     ></script>
     <script
-      src="/_next/static/oXgInwUCDXMkgHEU6-p4X/_buildManifest.js"
+      src="/_next/static/GMZFi2uqGsBnsZwytuz_Q/_buildManifest.js"
       async=""
     ></script>
     <script
-      src="/_next/static/oXgInwUCDXMkgHEU6-p4X/_ssgManifest.js"
+      src="/_next/static/GMZFi2uqGsBnsZwytuz_Q/_ssgManifest.js"
       async=""
     ></script>
   </body>
Commit: bfb81fa

@ijjk ijjk marked this pull request as ready for review April 15, 2021 01:29
@ijjk
Copy link
Member Author

ijjk commented Apr 15, 2021

Stats from current PR

Default Server Mode (Decrease detected ✓)
General Overall increase ⚠️
vercel/next.js canary ijjk/next.js fix/top-level-app Change
buildDuration 16.2s 15.8s -373ms
nodeModulesSize 46.2 MB 46.2 MB ⚠️ +2.85 kB
Page Load Tests Overall decrease ⚠️
vercel/next.js canary ijjk/next.js fix/top-level-app Change
/ failed reqs 0 0
/ total time (seconds) 2.879 2.862 -0.02
/ avg req/sec 868.5 873.37 +4.87
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.61 1.663 ⚠️ +0.05
/error-in-render avg req/sec 1552.75 1503.48 ⚠️ -49.27
Client Bundles (main, webpack, commons)
vercel/next.js canary ijjk/next.js fix/top-level-app Change
597-3f457946..288d.js gzip 13.3 kB 13.3 kB
778-9c11a899..1178.js gzip 7.05 kB 7.05 kB
framework.HASH.js gzip 39.3 kB 39.3 kB
main-HASH.js gzip 151 B 151 B
webpack-HASH.js gzip 993 B 993 B
Overall change 60.8 kB 60.8 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary ijjk/next.js fix/top-level-app Change
polyfills-HASH.js gzip 31.1 kB 31.1 kB
Overall change 31.1 kB 31.1 kB
Client Pages
vercel/next.js canary ijjk/next.js fix/top-level-app Change
_app-5cc66b2..6f03.js gzip 1.3 kB 1.3 kB
_error-55112..054d.js gzip 3.68 kB 3.68 kB
amp-89a5460c..567f.js gzip 558 B 558 B
hooks-8c2e74..be37.js gzip 924 B 924 B
index-fec729..83b2.js gzip 243 B 243 B
link-dd34d9b..0ade.js gzip 1.66 kB 1.66 kB
routerDirect..5759.js gzip 336 B 336 B
withRouter-1..98bf.js gzip 334 B 334 B
Overall change 9.03 kB 9.03 kB
Client Build Manifests
vercel/next.js canary ijjk/next.js fix/top-level-app Change
_buildManifest.js gzip 349 B 349 B
Overall change 349 B 349 B
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary ijjk/next.js fix/top-level-app Change
index.html gzip 609 B 609 B
link.html gzip 616 B 615 B -1 B
withRouter.html gzip 605 B 603 B -2 B
Overall change 1.83 kB 1.83 kB -3 B

Diffs

Diff for main-HASH.js
@@ -601,10 +601,10 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
         var _ref3 = _asyncToGenerator(
           /*#__PURE__*/ _regeneratorRuntime.mark(function _callee() {
             var opts,
+              initialErr,
               appEntrypoint,
               app,
               mod,
-              initialErr,
               pageEntrypoint,
               _require7,
               isValidElementType,
@@ -627,20 +627,22 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
                       if (false) {
                       }
 
-                      _context.next = 4;
+                      initialErr = hydrateErr;
+                      _context.prev = 3;
+                      _context.next = 6;
                       return pageLoader.routeLoader.whenEntrypoint("/_app");
 
-                    case 4:
+                    case 6:
                       appEntrypoint = _context.sent;
 
                       if (!("error" in appEntrypoint)) {
-                        _context.next = 7;
+                        _context.next = 9;
                         break;
                       }
 
                       throw appEntrypoint.error;
 
-                    case 7:
+                    case 9:
                       (app = appEntrypoint.component),
                         (mod = appEntrypoint.exports);
                       CachedApp = app;
@@ -679,9 +681,6 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
                         };
                       }
 
-                      initialErr = hydrateErr;
-                      _context.prev = 11;
-
                       if (true) {
                         _context.next = 16;
                         break;
@@ -745,7 +744,7 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
 
                     case 29:
                       _context.prev = 29;
-                      _context.t1 = _context["catch"](11);
+                      _context.t1 = _context["catch"](3);
                       // This catches errors like throwing in the top level of a module
                       initialErr = _context.t1;
 
@@ -826,7 +825,7 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
               },
               _callee,
               null,
-              [[11, 29]]
+              [[3, 29]]
             );
           })
         );
Diff for index.html
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/main-e495f9ee147cf2c28307.js"
+      href="/_next/static/chunks/main-02667db6a7ce35d873bc.js"
       as="script"
     />
     <link
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/main-e495f9ee147cf2c28307.js"
+      src="/_next/static/chunks/main-02667db6a7ce35d873bc.js"
       async=""
     ></script>
     <script
Diff for link.html
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/main-e495f9ee147cf2c28307.js"
+      href="/_next/static/chunks/main-02667db6a7ce35d873bc.js"
       as="script"
     />
     <link
@@ -70,7 +70,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/main-e495f9ee147cf2c28307.js"
+      src="/_next/static/chunks/main-02667db6a7ce35d873bc.js"
       async=""
     ></script>
     <script
Diff for withRouter.html
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/main-e495f9ee147cf2c28307.js"
+      href="/_next/static/chunks/main-02667db6a7ce35d873bc.js"
       as="script"
     />
     <link
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/main-e495f9ee147cf2c28307.js"
+      src="/_next/static/chunks/main-02667db6a7ce35d873bc.js"
       async=""
     ></script>
     <script

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary ijjk/next.js fix/top-level-app Change
buildDuration 20.1s 20.2s ⚠️ +178ms
nodeModulesSize 46.2 MB 46.2 MB ⚠️ +2.85 kB
Client Bundles (main, webpack, commons)
vercel/next.js canary ijjk/next.js fix/top-level-app Change
597-3f457946..288d.js gzip 13.3 kB 13.3 kB
778-9c11a899..1178.js gzip 7.05 kB N/A N/A
framework.HASH.js gzip 39.3 kB 39.3 kB
main-HASH.js gzip 151 B 151 B
webpack-HASH.js gzip 993 B 993 B
778-bfe2f654..5720.js gzip N/A 7.05 kB N/A
Overall change 60.8 kB 60.8 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary ijjk/next.js fix/top-level-app Change
polyfills-HASH.js gzip 31.1 kB 31.1 kB
Overall change 31.1 kB 31.1 kB
Client Pages
vercel/next.js canary ijjk/next.js fix/top-level-app Change
_app-5cc66b2..6f03.js gzip 1.3 kB 1.3 kB
_error-55112..054d.js gzip 3.68 kB 3.68 kB
amp-89a5460c..567f.js gzip 558 B 558 B
hooks-8c2e74..be37.js gzip 924 B 924 B
index-fec729..83b2.js gzip 243 B 243 B
link-dd34d9b..0ade.js gzip 1.66 kB 1.66 kB
routerDirect..5759.js gzip 336 B 336 B
withRouter-1..98bf.js gzip 334 B 334 B
Overall change 9.03 kB 9.03 kB
Client Build Manifests
vercel/next.js canary ijjk/next.js fix/top-level-app Change
_buildManifest.js gzip 349 B 349 B
Overall change 349 B 349 B
Serverless bundles Overall increase ⚠️
vercel/next.js canary ijjk/next.js fix/top-level-app Change
_error.js 1.39 MB 1.39 MB ⚠️ +555 B
404.html 2.76 kB 2.76 kB
500.html 2.75 kB 2.75 kB
amp.amp.html 10.7 kB 10.7 kB
amp.html 1.96 kB 1.96 kB
hooks.html 2.01 kB 2.01 kB
index.js 1.39 MB 1.39 MB ⚠️ +555 B
link.js 1.45 MB 1.45 MB ⚠️ +557 B
routerDirect.js 1.44 MB 1.44 MB ⚠️ +553 B
withRouter.js 1.44 MB 1.44 MB ⚠️ +555 B
Overall change 7.14 MB 7.14 MB ⚠️ +2.77 kB

Webpack 5 Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary ijjk/next.js fix/top-level-app Change
buildDuration 15.8s 16s ⚠️ +211ms
nodeModulesSize 46.2 MB 46.2 MB ⚠️ +2.85 kB
Page Load Tests Overall increase ✓
vercel/next.js canary ijjk/next.js fix/top-level-app Change
/ failed reqs 0 0
/ total time (seconds) 2.928 2.904 -0.02
/ avg req/sec 853.78 860.83 +7.05
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.685 1.643 -0.04
/error-in-render avg req/sec 1483.71 1521.27 +37.56
Client Bundles (main, webpack, commons)
vercel/next.js canary ijjk/next.js fix/top-level-app Change
597-3f457946..288d.js gzip 13.3 kB 13.3 kB
778-9c11a899..1178.js gzip 7.05 kB 7.05 kB
framework.HASH.js gzip 39.3 kB 39.3 kB
main-HASH.js gzip 151 B 151 B
webpack-HASH.js gzip 993 B 993 B
Overall change 60.8 kB 60.8 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary ijjk/next.js fix/top-level-app Change
polyfills-HASH.js gzip 31.1 kB 31.1 kB
Overall change 31.1 kB 31.1 kB
Client Pages
vercel/next.js canary ijjk/next.js fix/top-level-app Change
_app-5cc66b2..6f03.js gzip 1.3 kB 1.3 kB
_error-55112..054d.js gzip 3.68 kB 3.68 kB
amp-89a5460c..567f.js gzip 558 B 558 B
hooks-8c2e74..be37.js gzip 924 B 924 B
index-fec729..83b2.js gzip 243 B 243 B
link-dd34d9b..0ade.js gzip 1.66 kB 1.66 kB
routerDirect..5759.js gzip 336 B 336 B
withRouter-1..98bf.js gzip 334 B 334 B
Overall change 9.03 kB 9.03 kB
Client Build Manifests
vercel/next.js canary ijjk/next.js fix/top-level-app Change
_buildManifest.js gzip 349 B 349 B
Overall change 349 B 349 B
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary ijjk/next.js fix/top-level-app Change
index.html gzip 609 B 609 B
link.html gzip 616 B 615 B -1 B
withRouter.html gzip 605 B 603 B -2 B
Overall change 1.83 kB 1.83 kB -3 B

Diffs

Diff for 778-9c11a899..337771178.js
@@ -400,27 +400,29 @@
                     case 0:
                       return (
                         s.length > 0 && void 0 !== s[0] ? s[0] : {},
-                        (e.next = 4),
+                        (r = F),
+                        (e.prev = 3),
+                        (e.next = 6),
                         Q.routeLoader.whenEntrypoint("/_app")
                       );
-                    case 4:
-                      if (!("error" in (r = e.sent))) {
-                        e.next = 7;
+                    case 6:
+                      if (!("error" in (o = e.sent))) {
+                        e.next = 9;
                         break;
                       }
-                      throw r.error;
-                    case 7:
-                      (o = r.component),
-                        (a = r.exports),
-                        (Z = o),
-                        a &&
-                          a.reportWebVitals &&
+                      throw o.error;
+                    case 9:
+                      (a = o.component),
+                        (i = o.exports),
+                        (Z = a),
+                        i &&
+                          i.reportWebVitals &&
                           (ee = function(e) {
                             var t,
                               r = e.id,
                               n = e.name,
                               o = e.startTime,
-                              i = e.value,
+                              a = e.value,
                               u = e.duration,
                               c = e.entryType,
                               s = e.entries,
@@ -431,19 +433,17 @@
                                     1e12
                                 );
                             s && s.length && (t = s[0].startTime),
-                              a.reportWebVitals({
+                              i.reportWebVitals({
                                 id: r || l,
                                 name: n,
                                 startTime: o || t,
-                                value: null == i ? u : i,
+                                value: null == a ? u : a,
                                 label:
                                   "mark" === c || "measure" === c
                                     ? "custom"
                                     : "web-vital"
                               });
                           }),
-                        (i = F),
-                        (e.prev = 11),
                         (e.next = 16);
                       break;
                     case 16:
@@ -463,7 +463,7 @@
                       e.next = 32;
                       break;
                     case 29:
-                      (e.prev = 29), (e.t1 = e.catch(11)), (i = e.t1);
+                      (e.prev = 29), (e.t1 = e.catch(3)), (r = e.t1);
                     case 32:
                       if (!window.__NEXT_PRELOADREADY) {
                         e.next = 36;
@@ -478,7 +478,7 @@
                           App: Z,
                           Component: ne,
                           wrapApp: ve,
-                          err: i,
+                          err: r,
                           isFallback: Boolean(H),
                           subscription: function(e, t, r) {
                             return ue(
@@ -497,7 +497,7 @@
                             initial: !0,
                             Component: ne,
                             props: L,
-                            err: i
+                            err: r
                           })
                         ),
                         e.abrupt("return", ae)
@@ -515,7 +515,7 @@
               },
               e,
               null,
-              [[11, 29]]
+              [[3, 29]]
             );
           })
         );
Diff for index.html
@@ -7,7 +7,7 @@
     <noscript data-n-css=""></noscript>
     <link
       rel="preload"
-      href="/_next/static/chunks/webpack-0b22b91dc4c1318b0aae.js"
+      href="/_next/static/chunks/webpack-ada63f0bc4b3f0933210.js"
       as="script"
     />
     <link
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/778-9c11a89976b337771178.js"
+      href="/_next/static/chunks/778-bfe2f6545b0bec9e5720.js"
       as="script"
     />
     <link
@@ -48,7 +48,7 @@
         "props": { "pageProps": {} },
         "page": "/",
         "query": {},
-        "buildId": "yccPisR7fMFCMvkkO67uv",
+        "buildId": "GdDGEfLW6sfQEqCWAz6Vx",
         "isFallback": false,
         "gip": true
       }
@@ -58,7 +58,7 @@
       src="/_next/static/chunks/polyfills-8683bd742a84c1edd48c.js"
     ></script>
     <script
-      src="/_next/static/chunks/webpack-0b22b91dc4c1318b0aae.js"
+      src="/_next/static/chunks/webpack-ada63f0bc4b3f0933210.js"
       async=""
     ></script>
     <script
@@ -70,7 +70,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/778-9c11a89976b337771178.js"
+      src="/_next/static/chunks/778-bfe2f6545b0bec9e5720.js"
       async=""
     ></script>
     <script
@@ -86,11 +86,11 @@
       async=""
     ></script>
     <script
-      src="/_next/static/yccPisR7fMFCMvkkO67uv/_buildManifest.js"
+      src="/_next/static/GdDGEfLW6sfQEqCWAz6Vx/_buildManifest.js"
       async=""
     ></script>
     <script
-      src="/_next/static/yccPisR7fMFCMvkkO67uv/_ssgManifest.js"
+      src="/_next/static/GdDGEfLW6sfQEqCWAz6Vx/_ssgManifest.js"
       async=""
     ></script>
   </body>
Diff for link.html
@@ -7,7 +7,7 @@
     <noscript data-n-css=""></noscript>
     <link
       rel="preload"
-      href="/_next/static/chunks/webpack-0b22b91dc4c1318b0aae.js"
+      href="/_next/static/chunks/webpack-ada63f0bc4b3f0933210.js"
       as="script"
     />
     <link
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/778-9c11a89976b337771178.js"
+      href="/_next/static/chunks/778-bfe2f6545b0bec9e5720.js"
       as="script"
     />
     <link
@@ -53,7 +53,7 @@
         "props": { "pageProps": {} },
         "page": "/link",
         "query": {},
-        "buildId": "yccPisR7fMFCMvkkO67uv",
+        "buildId": "GdDGEfLW6sfQEqCWAz6Vx",
         "isFallback": false,
         "gip": true
       }
@@ -63,7 +63,7 @@
       src="/_next/static/chunks/polyfills-8683bd742a84c1edd48c.js"
     ></script>
     <script
-      src="/_next/static/chunks/webpack-0b22b91dc4c1318b0aae.js"
+      src="/_next/static/chunks/webpack-ada63f0bc4b3f0933210.js"
       async=""
     ></script>
     <script
@@ -75,7 +75,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/778-9c11a89976b337771178.js"
+      src="/_next/static/chunks/778-bfe2f6545b0bec9e5720.js"
       async=""
     ></script>
     <script
@@ -91,11 +91,11 @@
       async=""
     ></script>
     <script
-      src="/_next/static/yccPisR7fMFCMvkkO67uv/_buildManifest.js"
+      src="/_next/static/GdDGEfLW6sfQEqCWAz6Vx/_buildManifest.js"
       async=""
     ></script>
     <script
-      src="/_next/static/yccPisR7fMFCMvkkO67uv/_ssgManifest.js"
+      src="/_next/static/GdDGEfLW6sfQEqCWAz6Vx/_ssgManifest.js"
       async=""
     ></script>
   </body>
Diff for withRouter.html
@@ -7,7 +7,7 @@
     <noscript data-n-css=""></noscript>
     <link
       rel="preload"
-      href="/_next/static/chunks/webpack-0b22b91dc4c1318b0aae.js"
+      href="/_next/static/chunks/webpack-ada63f0bc4b3f0933210.js"
       as="script"
     />
     <link
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/778-9c11a89976b337771178.js"
+      href="/_next/static/chunks/778-bfe2f6545b0bec9e5720.js"
       as="script"
     />
     <link
@@ -48,7 +48,7 @@
         "props": { "pageProps": {} },
         "page": "/withRouter",
         "query": {},
-        "buildId": "yccPisR7fMFCMvkkO67uv",
+        "buildId": "GdDGEfLW6sfQEqCWAz6Vx",
         "isFallback": false,
         "gip": true
       }
@@ -58,7 +58,7 @@
       src="/_next/static/chunks/polyfills-8683bd742a84c1edd48c.js"
     ></script>
     <script
-      src="/_next/static/chunks/webpack-0b22b91dc4c1318b0aae.js"
+      src="/_next/static/chunks/webpack-ada63f0bc4b3f0933210.js"
       async=""
     ></script>
     <script
@@ -70,7 +70,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/778-9c11a89976b337771178.js"
+      src="/_next/static/chunks/778-bfe2f6545b0bec9e5720.js"
       async=""
     ></script>
     <script
@@ -86,11 +86,11 @@
       async=""
     ></script>
     <script
-      src="/_next/static/yccPisR7fMFCMvkkO67uv/_buildManifest.js"
+      src="/_next/static/GdDGEfLW6sfQEqCWAz6Vx/_buildManifest.js"
       async=""
     ></script>
     <script
-      src="/_next/static/yccPisR7fMFCMvkkO67uv/_ssgManifest.js"
+      src="/_next/static/GdDGEfLW6sfQEqCWAz6Vx/_ssgManifest.js"
       async=""
     ></script>
   </body>
Commit: 1bafc08

@kodiakhq kodiakhq bot merged commit 1797fc5 into vercel:canary Apr 15, 2021
@ijjk ijjk deleted the fix/top-level-app branch April 15, 2021 13:31
SokratisVidros pushed a commit to SokratisVidros/next.js that referenced this pull request Apr 20, 2021
…#24079)

This fixes an internal server error showing when a top-level error occurs in `_app` in development instead of the dev overlay. This includes the failing test case from vercel#24069 and also ensures the overlay is cleared when the error is corrected. 

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added

Fixes: vercel#24070
Closes: vercel#24069
kodiakhq bot pushed a commit that referenced this pull request Apr 21, 2021
This adds an additional test for the change in #24079 to ensure top-level errors in `_document` are also handled correctly. 

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [ ] Make sure the linting passes
SokratisVidros pushed a commit to SokratisVidros/next.js that referenced this pull request Apr 21, 2021
This adds an additional test for the change in vercel#24079 to ensure top-level errors in `_document` are also handled correctly. 

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [ ] Make sure the linting passes
@vercel vercel locked as resolved and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Top level error thrown in pages/_app causes app to render internal server error
2 participants