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

Add res.redirect response helper #14705

Merged
merged 22 commits into from
Jul 7, 2020
Merged

Add res.redirect response helper #14705

merged 22 commits into from
Jul 7, 2020

Conversation

botv
Copy link
Contributor

@botv botv commented Jun 30, 2020

Add an Express-like res.redirect response helper (defined by Express here). Solves #14646 and simplifies cases where a redirect is necessary for an API endpoint or a page (for example, redirecting to login in getServerSideProps). Ultimately, eliminates the need for the all-too-common line:

res.writeHead(307, { Location: '/login' }).end()

In the future, it might be cool to add more response helpers as defined and documented by Express:

Closes #14646

@ijjk
Copy link
Member

ijjk commented Jun 30, 2020

Stats from current PR

Default Server Mode (Decrease detected ✓)
General Overall increase ⚠️
vercel/next.js canary botv/next.js response-helpers Change
buildDuration 13.3s 13s -238ms
nodeModulesSize 66 MB 66 MB ⚠️ +1.44 kB
Page Load Tests Overall decrease ⚠️
vercel/next.js canary botv/next.js response-helpers Change
/ failed reqs 0 0
/ total time (seconds) 2.226 2.355 ⚠️ +0.13
/ avg req/sec 1122.96 1061.37 ⚠️ -61.59
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.544 1.494 -0.05
/error-in-render avg req/sec 1618.94 1673.63 +54.69
Client Bundles (main, webpack, commons)
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.js gzip 6.59 kB 6.59 kB
webpack-HASH.js gzip 751 B 751 B
19b7e98f51cc..769f.js gzip 10.7 kB 10.7 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57.2 kB 57.2 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.module.js gzip 5.68 kB 5.68 kB
webpack-HASH..dule.js gzip 751 B 751 B
19b7e98f51cc..dule.js gzip 7.09 kB 7.09 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.7 kB 52.7 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary botv/next.js response-helpers Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Build Manifests
vercel/next.js canary botv/next.js response-helpers Change
_buildManifest.js gzip 268 B 268 B
_buildManife..dule.js gzip 272 B 272 B
Overall change 540 B 540 B
Rendered Page Sizes
vercel/next.js canary botv/next.js response-helpers Change
index.html gzip 951 B 951 B
link.html gzip 960 B 960 B
withRouter.html gzip 943 B 943 B
Overall change 2.85 kB 2.85 kB

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary botv/next.js response-helpers Change
buildDuration 14.1s 14.2s ⚠️ +109ms
nodeModulesSize 66 MB 66 MB ⚠️ +1.44 kB
Client Bundles (main, webpack, commons)
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.js gzip 6.59 kB 6.59 kB
webpack-HASH.js gzip 751 B 751 B
19b7e98f51cc..769f.js gzip 10.7 kB 10.7 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57.2 kB 57.2 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.module.js gzip 5.68 kB 5.68 kB
webpack-HASH..dule.js gzip 751 B 751 B
19b7e98f51cc..dule.js gzip 7.09 kB 7.09 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.7 kB 52.7 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary botv/next.js response-helpers Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Build Manifests
vercel/next.js canary botv/next.js response-helpers Change
_buildManifest.js gzip 268 B 268 B
_buildManife..dule.js gzip 272 B 272 B
Overall change 540 B 540 B
Serverless bundles Overall increase ⚠️
vercel/next.js canary botv/next.js response-helpers Change
_error.js 875 kB 876 kB ⚠️ +318 B
404.html 4.17 kB 4.17 kB
hooks.html 3.79 kB 3.79 kB
index.js 876 kB 876 kB ⚠️ +318 B
link.js 915 kB 915 kB ⚠️ +318 B
routerDirect.js 907 kB 908 kB ⚠️ +318 B
withRouter.js 907 kB 908 kB ⚠️ +318 B
Overall change 4.49 MB 4.49 MB ⚠️ +1.59 kB
Commit: cad0d12

@ijjk
Copy link
Member

ijjk commented Jun 30, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary botv/next.js response-helpers Change
buildDuration 11.3s 11.3s ⚠️ +38ms
nodeModulesSize 66 MB 66 MB ⚠️ +1.44 kB
Page Load Tests Overall increase ✓
vercel/next.js canary botv/next.js response-helpers Change
/ failed reqs 0 0
/ total time (seconds) 1.826 1.837 ⚠️ +0.01
/ avg req/sec 1369.38 1361.16 ⚠️ -8.22
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.148 1.074 -0.07
/error-in-render avg req/sec 2178.06 2326.85 +148.79
Client Bundles (main, webpack, commons)
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.js gzip 6.59 kB 6.59 kB
webpack-HASH.js gzip 751 B 751 B
19b7e98f51cc..769f.js gzip 10.7 kB 10.7 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57.2 kB 57.2 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.module.js gzip 5.68 kB 5.68 kB
webpack-HASH..dule.js gzip 751 B 751 B
19b7e98f51cc..dule.js gzip 7.09 kB 7.09 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.7 kB 52.7 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary botv/next.js response-helpers Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Build Manifests
vercel/next.js canary botv/next.js response-helpers Change
_buildManifest.js gzip 268 B 268 B
_buildManife..dule.js gzip 272 B 272 B
Overall change 540 B 540 B
Rendered Page Sizes
vercel/next.js canary botv/next.js response-helpers Change
index.html gzip 951 B 951 B
link.html gzip 960 B 960 B
withRouter.html gzip 943 B 943 B
Overall change 2.85 kB 2.85 kB

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary botv/next.js response-helpers Change
buildDuration 12.3s 12.3s -18ms
nodeModulesSize 66 MB 66 MB ⚠️ +1.44 kB
Client Bundles (main, webpack, commons)
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.js gzip 6.59 kB 6.59 kB
webpack-HASH.js gzip 751 B 751 B
19b7e98f51cc..769f.js gzip 10.7 kB 10.7 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57.2 kB 57.2 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.module.js gzip 5.68 kB 5.68 kB
webpack-HASH..dule.js gzip 751 B 751 B
19b7e98f51cc..dule.js gzip 7.09 kB 7.09 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.7 kB 52.7 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary botv/next.js response-helpers Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Build Manifests
vercel/next.js canary botv/next.js response-helpers Change
_buildManifest.js gzip 268 B 268 B
_buildManife..dule.js gzip 272 B 272 B
Overall change 540 B 540 B
Serverless bundles Overall increase ⚠️
vercel/next.js canary botv/next.js response-helpers Change
_error.js 875 kB 876 kB ⚠️ +318 B
404.html 4.17 kB 4.17 kB
hooks.html 3.79 kB 3.79 kB
index.js 876 kB 876 kB ⚠️ +318 B
link.js 915 kB 915 kB ⚠️ +318 B
routerDirect.js 907 kB 908 kB ⚠️ +318 B
withRouter.js 907 kB 908 kB ⚠️ +318 B
Overall change 4.49 MB 4.49 MB ⚠️ +1.59 kB
Commit: 88cdad2

@ijjk
Copy link
Member

ijjk commented Jun 30, 2020

Failing test suites

Commit: cad0d12

test/integration/prerender/test/index.test.js

  • SSG Prerender > production mode > outputs prerendered files correctly
Expand output

● SSG Prerender › production mode › outputs prerendered files correctly

ENOENT: no such file or directory, access '/home/runner/work/next.js/next.js/test/integration/prerender/.next/server/pages/another.html'

@ijjk
Copy link
Member

ijjk commented Jun 30, 2020

Failing test suites

Commit: 88cdad2

test/integration/prerender/test/index.test.js

  • SSG Prerender > production mode > outputs prerendered files correctly
Expand output

● SSG Prerender › production mode › outputs prerendered files correctly

ENOENT: no such file or directory, access '/home/runner/work/next.js/next.js/test/integration/prerender/.next/server/pages/another.html'

Copy link
Member

@lfades lfades left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The common way of redirecting is fine, we don't have to match Express helpers. If redirecting is complicated then maybe we can mention it on docs instead and/or create an example for it.

@botv
Copy link
Contributor Author

botv commented Jun 30, 2020

The common way of redirecting is fine, we don't have to match Express helpers. If redirecting is complicated then maybe we can mention it on docs instead and/or create an example for it.

Because so many people use Express and expect this helper (I myself was confused why it didn't exist) it would be wise to add it. It also solves a lot of problems with other libraries such as Passport.js, where certain auth strategy middlewares use the res.redirect helper internally.

@ijjk
Copy link
Member

ijjk commented Jun 30, 2020

Stats from current PR

Default Server Mode (Decrease detected ✓)
General Overall increase ⚠️
vercel/next.js canary botv/next.js response-helpers Change
buildDuration 12.2s 11.3s -878ms
nodeModulesSize 66 MB 66 MB ⚠️ +1.75 kB
Page Load Tests Overall decrease ⚠️
vercel/next.js canary botv/next.js response-helpers Change
/ failed reqs 0 0
/ total time (seconds) 2.045 2.023 -0.02
/ avg req/sec 1222.67 1235.63 +12.96
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.321 1.348 ⚠️ +0.03
/error-in-render avg req/sec 1892.19 1854.2 ⚠️ -37.99
Client Bundles (main, webpack, commons)
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.js gzip 6.59 kB 6.59 kB
webpack-HASH.js gzip 751 B 751 B
19b7e98f51cc..769f.js gzip 10.7 kB 10.7 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57.2 kB 57.2 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.module.js gzip 5.68 kB 5.68 kB
webpack-HASH..dule.js gzip 751 B 751 B
19b7e98f51cc..dule.js gzip 7.09 kB 7.09 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.7 kB 52.7 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary botv/next.js response-helpers Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Build Manifests
vercel/next.js canary botv/next.js response-helpers Change
_buildManifest.js gzip 268 B 268 B
_buildManife..dule.js gzip 272 B 272 B
Overall change 540 B 540 B
Rendered Page Sizes
vercel/next.js canary botv/next.js response-helpers Change
index.html gzip 952 B 952 B
link.html gzip 961 B 961 B
withRouter.html gzip 945 B 945 B
Overall change 2.86 kB 2.86 kB

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary botv/next.js response-helpers Change
buildDuration 12.2s 12.1s -128ms
nodeModulesSize 66 MB 66 MB ⚠️ +1.75 kB
Client Bundles (main, webpack, commons)
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.js gzip 6.59 kB 6.59 kB
webpack-HASH.js gzip 751 B 751 B
19b7e98f51cc..769f.js gzip 10.7 kB 10.7 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57.2 kB 57.2 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.module.js gzip 5.68 kB 5.68 kB
webpack-HASH..dule.js gzip 751 B 751 B
19b7e98f51cc..dule.js gzip 7.09 kB 7.09 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.7 kB 52.7 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary botv/next.js response-helpers Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Build Manifests
vercel/next.js canary botv/next.js response-helpers Change
_buildManifest.js gzip 268 B 268 B
_buildManife..dule.js gzip 272 B 272 B
Overall change 540 B 540 B
Serverless bundles Overall increase ⚠️
vercel/next.js canary botv/next.js response-helpers Change
_error.js 875 kB 876 kB ⚠️ +385 B
404.html 4.17 kB 4.17 kB
hooks.html 3.79 kB 3.79 kB
index.js 876 kB 876 kB ⚠️ +385 B
link.js 915 kB 915 kB ⚠️ +385 B
routerDirect.js 907 kB 908 kB ⚠️ +385 B
withRouter.js 907 kB 908 kB ⚠️ +385 B
Overall change 4.49 MB 4.49 MB ⚠️ +1.93 kB
Commit: 001dcff

@ijjk
Copy link
Member

ijjk commented Jun 30, 2020

Stats from current PR

Default Server Mode (Decrease detected ✓)
General Overall increase ⚠️
vercel/next.js canary botv/next.js response-helpers Change
buildDuration 11.9s 12s ⚠️ +115ms
nodeModulesSize 66 MB 66 MB ⚠️ +1.75 kB
Page Load Tests Overall decrease ⚠️
vercel/next.js canary botv/next.js response-helpers Change
/ failed reqs 0 0
/ total time (seconds) 2.037 2.02 -0.02
/ avg req/sec 1227.27 1237.6 +10.33
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.214 1.265 ⚠️ +0.05
/error-in-render avg req/sec 2058.55 1976.98 ⚠️ -81.57
Client Bundles (main, webpack, commons)
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.js gzip 6.59 kB 6.59 kB
webpack-HASH.js gzip 751 B 751 B
19b7e98f51cc..769f.js gzip 10.7 kB 10.7 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57.2 kB 57.2 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.module.js gzip 5.68 kB 5.68 kB
webpack-HASH..dule.js gzip 751 B 751 B
19b7e98f51cc..dule.js gzip 7.09 kB 7.09 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.7 kB 52.7 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary botv/next.js response-helpers Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Build Manifests
vercel/next.js canary botv/next.js response-helpers Change
_buildManifest.js gzip 268 B 268 B
_buildManife..dule.js gzip 272 B 272 B
Overall change 540 B 540 B
Rendered Page Sizes
vercel/next.js canary botv/next.js response-helpers Change
index.html gzip 952 B 952 B
link.html gzip 961 B 961 B
withRouter.html gzip 945 B 945 B
Overall change 2.86 kB 2.86 kB

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary botv/next.js response-helpers Change
buildDuration 13s 13s -50ms
nodeModulesSize 66 MB 66 MB ⚠️ +1.75 kB
Client Bundles (main, webpack, commons)
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.js gzip 6.59 kB 6.59 kB
webpack-HASH.js gzip 751 B 751 B
19b7e98f51cc..769f.js gzip 10.7 kB 10.7 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57.2 kB 57.2 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.module.js gzip 5.68 kB 5.68 kB
webpack-HASH..dule.js gzip 751 B 751 B
19b7e98f51cc..dule.js gzip 7.09 kB 7.09 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.7 kB 52.7 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary botv/next.js response-helpers Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Build Manifests
vercel/next.js canary botv/next.js response-helpers Change
_buildManifest.js gzip 268 B 268 B
_buildManife..dule.js gzip 272 B 272 B
Overall change 540 B 540 B
Serverless bundles Overall increase ⚠️
vercel/next.js canary botv/next.js response-helpers Change
_error.js 875 kB 876 kB ⚠️ +385 B
404.html 4.17 kB 4.17 kB
hooks.html 3.79 kB 3.79 kB
index.js 876 kB 876 kB ⚠️ +385 B
link.js 915 kB 915 kB ⚠️ +385 B
routerDirect.js 907 kB 908 kB ⚠️ +385 B
withRouter.js 907 kB 908 kB ⚠️ +385 B
Overall change 4.49 MB 4.49 MB ⚠️ +1.93 kB
Commit: a741d04

Copy link
Member

@timneutkens timneutkens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need tests in test/integration/api-support as well

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
@ijjk ijjk added the examples Issue/PR related to examples label Jul 3, 2020
@botv botv requested a review from Timer July 3, 2020 18:50
@ijjk
Copy link
Member

ijjk commented Jul 3, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary botv/next.js response-helpers Change
buildDuration 10.9s 11.3s ⚠️ +427ms
nodeModulesSize 66.1 MB 66.1 MB ⚠️ +1.74 kB
Page Load Tests Overall increase ✓
vercel/next.js canary botv/next.js response-helpers Change
/ failed reqs 0 0
/ total time (seconds) 1.89 1.838 -0.05
/ avg req/sec 1322.86 1360.44 +37.58
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.171 1.101 -0.07
/error-in-render avg req/sec 2134.58 2270.03 +135.45
Client Bundles (main, webpack, commons)
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.js gzip 6.63 kB 6.63 kB
webpack-HASH.js gzip 751 B 751 B
19b7e98f51cc..18e4.js gzip 10.7 kB 10.7 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57.2 kB 57.2 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.module.js gzip 5.71 kB 5.71 kB
webpack-HASH..dule.js gzip 751 B 751 B
19b7e98f51cc..dule.js gzip 7.09 kB 7.09 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.7 kB 52.7 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary botv/next.js response-helpers Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Build Manifests
vercel/next.js canary botv/next.js response-helpers Change
_buildManifest.js gzip 268 B 268 B
_buildManife..dule.js gzip 272 B 272 B
Overall change 540 B 540 B
Rendered Page Sizes
vercel/next.js canary botv/next.js response-helpers Change
index.html gzip 954 B 954 B
link.html gzip 959 B 959 B
withRouter.html gzip 946 B 946 B
Overall change 2.86 kB 2.86 kB

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary botv/next.js response-helpers Change
buildDuration 12.1s 11.3s -822ms
nodeModulesSize 66.1 MB 66.1 MB ⚠️ +1.74 kB
Client Bundles (main, webpack, commons)
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.js gzip 6.63 kB 6.63 kB
webpack-HASH.js gzip 751 B 751 B
19b7e98f51cc..18e4.js gzip 10.7 kB 10.7 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57.2 kB 57.2 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.module.js gzip 5.71 kB 5.71 kB
webpack-HASH..dule.js gzip 751 B 751 B
19b7e98f51cc..dule.js gzip 7.09 kB 7.09 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.7 kB 52.7 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary botv/next.js response-helpers Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Build Manifests
vercel/next.js canary botv/next.js response-helpers Change
_buildManifest.js gzip 268 B 268 B
_buildManife..dule.js gzip 272 B 272 B
Overall change 540 B 540 B
Serverless bundles Overall increase ⚠️
vercel/next.js canary botv/next.js response-helpers Change
_error.js 876 kB 876 kB ⚠️ +385 B
404.html 4.17 kB 4.17 kB
hooks.html 3.79 kB 3.79 kB
index.js 876 kB 876 kB ⚠️ +385 B
link.js 915 kB 915 kB ⚠️ +385 B
routerDirect.js 908 kB 908 kB ⚠️ +385 B
withRouter.js 908 kB 908 kB ⚠️ +385 B
Overall change 4.49 MB 4.49 MB ⚠️ +1.93 kB
Commit: 540c229

@ijjk
Copy link
Member

ijjk commented Jul 3, 2020

Stats from current PR

Default Server Mode (Decrease detected ✓)
General Overall increase ⚠️
vercel/next.js canary botv/next.js response-helpers Change
buildDuration 10.5s 10.7s ⚠️ +265ms
nodeModulesSize 66.1 MB 66.1 MB ⚠️ +1.74 kB
Page Load Tests Overall decrease ⚠️
vercel/next.js canary botv/next.js response-helpers Change
/ failed reqs 0 0
/ total time (seconds) 1.726 1.821 ⚠️ +0.09
/ avg req/sec 1448.08 1373.25 ⚠️ -74.83
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.046 1.088 ⚠️ +0.04
/error-in-render avg req/sec 2389.99 2297.67 ⚠️ -92.32
Client Bundles (main, webpack, commons)
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.js gzip 6.63 kB 6.63 kB
webpack-HASH.js gzip 751 B 751 B
19b7e98f51cc..18e4.js gzip 10.7 kB 10.7 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57.2 kB 57.2 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.module.js gzip 5.71 kB 5.71 kB
webpack-HASH..dule.js gzip 751 B 751 B
19b7e98f51cc..dule.js gzip 7.09 kB 7.09 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.7 kB 52.7 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary botv/next.js response-helpers Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Build Manifests
vercel/next.js canary botv/next.js response-helpers Change
_buildManifest.js gzip 268 B 268 B
_buildManife..dule.js gzip 272 B 272 B
Overall change 540 B 540 B
Rendered Page Sizes
vercel/next.js canary botv/next.js response-helpers Change
index.html gzip 954 B 954 B
link.html gzip 959 B 959 B
withRouter.html gzip 946 B 946 B
Overall change 2.86 kB 2.86 kB

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary botv/next.js response-helpers Change
buildDuration 11.3s 11.6s ⚠️ +339ms
nodeModulesSize 66.1 MB 66.1 MB ⚠️ +1.74 kB
Client Bundles (main, webpack, commons)
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.js gzip 6.63 kB 6.63 kB
webpack-HASH.js gzip 751 B 751 B
19b7e98f51cc..18e4.js gzip 10.7 kB 10.7 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57.2 kB 57.2 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.module.js gzip 5.71 kB 5.71 kB
webpack-HASH..dule.js gzip 751 B 751 B
19b7e98f51cc..dule.js gzip 7.09 kB 7.09 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.7 kB 52.7 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary botv/next.js response-helpers Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Build Manifests
vercel/next.js canary botv/next.js response-helpers Change
_buildManifest.js gzip 268 B 268 B
_buildManife..dule.js gzip 272 B 272 B
Overall change 540 B 540 B
Serverless bundles Overall increase ⚠️
vercel/next.js canary botv/next.js response-helpers Change
_error.js 876 kB 876 kB ⚠️ +385 B
404.html 4.17 kB 4.17 kB
hooks.html 3.79 kB 3.79 kB
index.js 876 kB 876 kB ⚠️ +385 B
link.js 915 kB 915 kB ⚠️ +385 B
routerDirect.js 908 kB 908 kB ⚠️ +385 B
withRouter.js 908 kB 908 kB ⚠️ +385 B
Overall change 4.49 MB 4.49 MB ⚠️ +1.93 kB
Commit: 76d702c

@ijjk
Copy link
Member

ijjk commented Jul 3, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary botv/next.js response-helpers Change
buildDuration 12.8s 12.6s -187ms
nodeModulesSize 66.1 MB 66.1 MB ⚠️ +1.74 kB
Page Load Tests Overall increase ✓
vercel/next.js canary botv/next.js response-helpers Change
/ failed reqs 0 0
/ total time (seconds) 2.034 2.03 0
/ avg req/sec 1228.82 1231.78 +2.96
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.272 1.221 -0.05
/error-in-render avg req/sec 1964.95 2048.18 +83.23
Client Bundles (main, webpack, commons)
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.js gzip 6.63 kB 6.63 kB
webpack-HASH.js gzip 751 B 751 B
19b7e98f51cc..18e4.js gzip 10.7 kB 10.7 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57.2 kB 57.2 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.module.js gzip 5.71 kB 5.71 kB
webpack-HASH..dule.js gzip 751 B 751 B
19b7e98f51cc..dule.js gzip 7.09 kB 7.09 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.7 kB 52.7 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary botv/next.js response-helpers Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Build Manifests
vercel/next.js canary botv/next.js response-helpers Change
_buildManifest.js gzip 268 B 268 B
_buildManife..dule.js gzip 272 B 272 B
Overall change 540 B 540 B
Rendered Page Sizes
vercel/next.js canary botv/next.js response-helpers Change
index.html gzip 954 B 954 B
link.html gzip 959 B 959 B
withRouter.html gzip 946 B 946 B
Overall change 2.86 kB 2.86 kB

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary botv/next.js response-helpers Change
buildDuration 13.6s 13.7s ⚠️ +182ms
nodeModulesSize 66.1 MB 66.1 MB ⚠️ +1.74 kB
Client Bundles (main, webpack, commons)
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.js gzip 6.63 kB 6.63 kB
webpack-HASH.js gzip 751 B 751 B
19b7e98f51cc..18e4.js gzip 10.7 kB 10.7 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57.2 kB 57.2 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.module.js gzip 5.71 kB 5.71 kB
webpack-HASH..dule.js gzip 751 B 751 B
19b7e98f51cc..dule.js gzip 7.09 kB 7.09 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.7 kB 52.7 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary botv/next.js response-helpers Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Build Manifests
vercel/next.js canary botv/next.js response-helpers Change
_buildManifest.js gzip 268 B 268 B
_buildManife..dule.js gzip 272 B 272 B
Overall change 540 B 540 B
Serverless bundles Overall increase ⚠️
vercel/next.js canary botv/next.js response-helpers Change
_error.js 876 kB 876 kB ⚠️ +385 B
404.html 4.17 kB 4.17 kB
hooks.html 3.79 kB 3.79 kB
index.js 876 kB 876 kB ⚠️ +385 B
link.js 915 kB 915 kB ⚠️ +385 B
routerDirect.js 908 kB 908 kB ⚠️ +385 B
withRouter.js 908 kB 908 kB ⚠️ +385 B
Overall change 4.49 MB 4.49 MB ⚠️ +1.93 kB
Commit: b0cc648

@ijjk
Copy link
Member

ijjk commented Jul 5, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary botv/next.js response-helpers Change
buildDuration 13.5s 13.4s -95ms
nodeModulesSize 66.1 MB 66.1 MB ⚠️ +1.74 kB
Page Load Tests Overall increase ✓
vercel/next.js canary botv/next.js response-helpers Change
/ failed reqs 0 0
/ total time (seconds) 2.344 2.25 -0.09
/ avg req/sec 1066.57 1111.21 +44.64
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.566 1.553 -0.01
/error-in-render avg req/sec 1596.22 1610.1 +13.88
Client Bundles (main, webpack, commons)
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.js gzip 6.63 kB 6.63 kB
webpack-HASH.js gzip 751 B 751 B
19b7e98f51cc..18e4.js gzip 10.7 kB 10.7 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57.2 kB 57.2 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.module.js gzip 5.71 kB 5.71 kB
webpack-HASH..dule.js gzip 751 B 751 B
19b7e98f51cc..dule.js gzip 7.09 kB 7.09 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.7 kB 52.7 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary botv/next.js response-helpers Change
polyfills-HASH.js gzip 26.4 kB 26.4 kB
Overall change 26.4 kB 26.4 kB
Client Build Manifests
vercel/next.js canary botv/next.js response-helpers Change
_buildManifest.js gzip 268 B 268 B
_buildManife..dule.js gzip 272 B 272 B
Overall change 540 B 540 B
Rendered Page Sizes
vercel/next.js canary botv/next.js response-helpers Change
index.html gzip 954 B 954 B
link.html gzip 958 B 958 B
withRouter.html gzip 945 B 945 B
Overall change 2.86 kB 2.86 kB

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary botv/next.js response-helpers Change
buildDuration 14.9s 14.8s -156ms
nodeModulesSize 66.1 MB 66.1 MB ⚠️ +3.48 kB
Client Bundles (main, webpack, commons)
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.js gzip 6.63 kB 6.63 kB
webpack-HASH.js gzip 751 B 751 B
19b7e98f51cc..18e4.js gzip 10.7 kB 10.7 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57.2 kB 57.2 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.module.js gzip 5.71 kB 5.71 kB
webpack-HASH..dule.js gzip 751 B 751 B
19b7e98f51cc..dule.js gzip 7.09 kB 7.09 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.7 kB 52.7 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary botv/next.js response-helpers Change
polyfills-HASH.js gzip 26.4 kB 26.4 kB
Overall change 26.4 kB 26.4 kB
Client Build Manifests
vercel/next.js canary botv/next.js response-helpers Change
_buildManifest.js gzip 268 B 268 B
_buildManife..dule.js gzip 272 B 272 B
Overall change 540 B 540 B
Serverless bundles Overall increase ⚠️
vercel/next.js canary botv/next.js response-helpers Change
_error.js 876 kB 876 kB ⚠️ +385 B
404.html 4.17 kB 4.17 kB
hooks.html 3.79 kB 3.79 kB
index.js 876 kB 876 kB ⚠️ +385 B
link.js 915 kB 915 kB ⚠️ +385 B
routerDirect.js 908 kB 908 kB ⚠️ +385 B
withRouter.js 908 kB 908 kB ⚠️ +385 B
Overall change 4.49 MB 4.49 MB ⚠️ +1.93 kB
Commit: 6fb56ba

Copy link
Member

@timneutkens timneutkens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Examples should only be updated after a feature lands as otherwise they'll be installed by users and it won't work.

@botv
Copy link
Contributor Author

botv commented Jul 5, 2020

Examples should only be updated after a feature lands as otherwise they'll be installed by users and it won't work.

My bad, I'll revert.

@ijjk
Copy link
Member

ijjk commented Jul 5, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary botv/next.js response-helpers Change
buildDuration 11.9s 12.4s ⚠️ +444ms
nodeModulesSize 66.1 MB 66.1 MB ⚠️ +1.74 kB
Page Load Tests Overall increase ✓
vercel/next.js canary botv/next.js response-helpers Change
/ failed reqs 0 0
/ total time (seconds) 2.178 2.139 -0.04
/ avg req/sec 1147.94 1168.89 +20.95
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.435 1.429 -0.01
/error-in-render avg req/sec 1741.88 1749.89 +8.01
Client Bundles (main, webpack, commons)
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.js gzip 6.63 kB 6.63 kB
webpack-HASH.js gzip 751 B 751 B
19b7e98f51cc..18e4.js gzip 10.7 kB 10.7 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57.2 kB 57.2 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.module.js gzip 5.71 kB 5.71 kB
webpack-HASH..dule.js gzip 751 B 751 B
19b7e98f51cc..dule.js gzip 7.09 kB 7.09 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.7 kB 52.7 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary botv/next.js response-helpers Change
polyfills-HASH.js gzip 26.4 kB 26.4 kB
Overall change 26.4 kB 26.4 kB
Client Build Manifests
vercel/next.js canary botv/next.js response-helpers Change
_buildManifest.js gzip 268 B 268 B
_buildManife..dule.js gzip 272 B 272 B
Overall change 540 B 540 B
Rendered Page Sizes
vercel/next.js canary botv/next.js response-helpers Change
index.html gzip 954 B 954 B
link.html gzip 958 B 958 B
withRouter.html gzip 945 B 945 B
Overall change 2.86 kB 2.86 kB

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary botv/next.js response-helpers Change
buildDuration 12.8s 13.3s ⚠️ +540ms
nodeModulesSize 66.1 MB 66.1 MB ⚠️ +1.74 kB
Client Bundles (main, webpack, commons)
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.js gzip 6.63 kB 6.63 kB
webpack-HASH.js gzip 751 B 751 B
19b7e98f51cc..18e4.js gzip 10.7 kB 10.7 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57.2 kB 57.2 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.module.js gzip 5.71 kB 5.71 kB
webpack-HASH..dule.js gzip 751 B 751 B
19b7e98f51cc..dule.js gzip 7.09 kB 7.09 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.7 kB 52.7 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary botv/next.js response-helpers Change
polyfills-HASH.js gzip 26.4 kB 26.4 kB
Overall change 26.4 kB 26.4 kB
Client Build Manifests
vercel/next.js canary botv/next.js response-helpers Change
_buildManifest.js gzip 268 B 268 B
_buildManife..dule.js gzip 272 B 272 B
Overall change 540 B 540 B
Serverless bundles Overall increase ⚠️
vercel/next.js canary botv/next.js response-helpers Change
_error.js 876 kB 876 kB ⚠️ +385 B
404.html 4.17 kB 4.17 kB
hooks.html 3.79 kB 3.79 kB
index.js 876 kB 876 kB ⚠️ +385 B
link.js 915 kB 915 kB ⚠️ +385 B
routerDirect.js 908 kB 908 kB ⚠️ +385 B
withRouter.js 908 kB 908 kB ⚠️ +385 B
Overall change 4.49 MB 4.49 MB ⚠️ +1.93 kB
Commit: 7350832

@botv botv requested a review from timneutkens July 5, 2020 21:04
@timneutkens
Copy link
Member

Great PR! 👍💯

@ijjk
Copy link
Member

ijjk commented Jul 7, 2020

Stats from current PR

Default Server Mode (Decrease detected ✓)
General Overall increase ⚠️
vercel/next.js canary botv/next.js response-helpers Change
buildDuration 11.1s 11.4s ⚠️ +330ms
nodeModulesSize 66.1 MB 66.1 MB ⚠️ +1.74 kB
Page Load Tests Overall decrease ⚠️
vercel/next.js canary botv/next.js response-helpers Change
/ failed reqs 0 0
/ total time (seconds) 1.883 1.842 -0.04
/ avg req/sec 1327.79 1357.58 +29.79
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.134 1.15 ⚠️ +0.02
/error-in-render avg req/sec 2205.53 2173.46 ⚠️ -32.07
Client Bundles (main, webpack, commons)
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.js gzip 6.63 kB 6.63 kB
webpack-HASH.js gzip 751 B 751 B
19b7e98f51cc..6834.js gzip 10.7 kB 10.7 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57.2 kB 57.2 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.module.js gzip 5.71 kB 5.71 kB
webpack-HASH..dule.js gzip 751 B 751 B
19b7e98f51cc..dule.js gzip 7.09 kB 7.09 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.7 kB 52.7 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary botv/next.js response-helpers Change
polyfills-HASH.js gzip 26.4 kB 26.4 kB
Overall change 26.4 kB 26.4 kB
Client Build Manifests
vercel/next.js canary botv/next.js response-helpers Change
_buildManifest.js gzip 268 B 268 B
_buildManife..dule.js gzip 272 B 272 B
Overall change 540 B 540 B
Rendered Page Sizes
vercel/next.js canary botv/next.js response-helpers Change
index.html gzip 953 B 953 B
link.html gzip 959 B 959 B
withRouter.html gzip 945 B 945 B
Overall change 2.86 kB 2.86 kB

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary botv/next.js response-helpers Change
buildDuration 12.4s 12.2s -215ms
nodeModulesSize 66.1 MB 66.1 MB ⚠️ +1.74 kB
Client Bundles (main, webpack, commons)
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.js gzip 6.63 kB 6.63 kB
webpack-HASH.js gzip 751 B 751 B
19b7e98f51cc..6834.js gzip 10.7 kB 10.7 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57.2 kB 57.2 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary botv/next.js response-helpers Change
main-HASH.module.js gzip 5.71 kB 5.71 kB
webpack-HASH..dule.js gzip 751 B 751 B
19b7e98f51cc..dule.js gzip 7.09 kB 7.09 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.7 kB 52.7 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary botv/next.js response-helpers Change
polyfills-HASH.js gzip 26.4 kB 26.4 kB
Overall change 26.4 kB 26.4 kB
Client Build Manifests
vercel/next.js canary botv/next.js response-helpers Change
_buildManifest.js gzip 268 B 268 B
_buildManife..dule.js gzip 272 B 272 B
Overall change 540 B 540 B
Serverless bundles Overall increase ⚠️
vercel/next.js canary botv/next.js response-helpers Change
_error.js 876 kB 876 kB ⚠️ +385 B
404.html 4.17 kB 4.17 kB
hooks.html 3.79 kB 3.79 kB
index.js 876 kB 877 kB ⚠️ +385 B
link.js 915 kB 915 kB ⚠️ +385 B
routerDirect.js 908 kB 909 kB ⚠️ +385 B
withRouter.js 908 kB 909 kB ⚠️ +385 B
Overall change 4.49 MB 4.49 MB ⚠️ +1.93 kB
Commit: 73c7fb7

@Timer Timer merged commit d19c343 into vercel:canary Jul 7, 2020
@@ -25,3 +25,4 @@ The included helpers are:
- `res.status(code)` - A function to set the status code. `code` must be a valid [HTTP status code](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes)
- `res.json(json)` - Sends a JSON response. `json` must be a valid JSON object
- `res.send(body)` - Sends the HTTP response. `body` can be a `string`, an `object` or a `Buffer`
- `res.redirect([status,] path)` - Redirects to a specified path or URL. `status` must be a valid [HTTP status code](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes). If not specified, `status` defaults to "302" "Found".
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be 307? @Timer

Copy link
Contributor Author

@botv botv Jul 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in #14947 @SarKurd

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, maybe here should say res.redirect([status], path) instead of res.redirect([status,] path), right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rokinsky pushed a commit to rokinsky/next.js that referenced this pull request Jul 11, 2020
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
kodiakhq bot pushed a commit that referenced this pull request Jan 4, 2021
… case (#20461)

This PR is a small follow-up to #14705. It saves Next.js users from falling into a [pretty nasty trap](nodejs/node#36620) in which I ended up last Friday. It took more than two days to investigate what was going on, so I hope I'm the last person who’s doing it 😅

Next.js-specific MWE: https://github.com/kachkaev/hanging-response-in-next-via-redirect-plus-compression (needs to be ran locally using Node 14.0.0+).

> <img width="521" alt="Screenshot 2020-12-24 at 20 50 00" src="https://user-images.githubusercontent.com/608862/103105989-a9b8dc00-4629-11eb-9be3-5108755604bf.png">

To reproduce the bug I’m fixing:

1. Pick a large http body size (64 or 128 KB)
1. Check _Call res.end() after res.redirect() in /api/redirect_
1. Navigate to a heavy page or an api handler via redirect
1. Observe that the http response is never finished.

If you set `compress` to `false` in `next.config.js` or pick a small payload size (< `zlib.Z_DEFAULT_CHUNK` after compression), the bug will not be observed. This is explained by the use of `res.on("drain", ...)` [by the `compression` package](https://github.com/expressjs/compression/blob/3fea81d0eaed1eb872bf3e0405f20d9e175ab2cf/index.js#L193-L218). The package itself is not the reason for an issue though, it seems to be in the Node’s built-in `http` package.

I’m happy to provide more info or GitHub CI to the MWE if needed. I was also thinking of adding some Next.js-specific testing, but could not come up with a compact and clear test plan. Happy to do this if there are any ideas.

cc @botv (author of #14705)
@vercel vercel locked as resolved and limited conversation to collaborators Jan 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
examples Issue/PR related to examples type: next
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add res.redirect response helper for Passport.js (and convenience)
7 participants