rsnext/errors
Kara 41484f62cc
Throw error if res is accessed after gSSP returns (#29010)
* Throw error if res is accessed after gSSP returns

Currently it's possible to access the `ServerResponse` through `context.res`
in `getServerSideProps()`. If one was to store that response and mutate
its headers or status code after gSSP returns (e.g. during rendering), it
would currently happen to work because of when headers are sent. However,
this is an anti-pattern that relies an implementation detail of the framework
and shouldn't be allowed. This will be particularly important once Next.js
starts to support basic streaming (two-part flush: routing then data) because
then the headers will be sent as soon as gSSP returns, which explicitly breaks
this pattern.

With this commit, the framework now throws an error in development mode if
the ServerResponse is accessed after gSSP returns.

* fixup! Throw error if res is accessed after gSSP returns
2021-09-13 17:10:46 -05:00
..
404-get-initial-props.md Rename getServerProps to getServerSideProps (#10722) 2020-02-27 11:04:30 -06:00
amp-bind-jsx-alt.md Add error message for AMP bind syntax (#6865) 2019-04-02 17:32:07 -05:00
amp-export-validation.md Add AMP validation on export (#6794) 2019-03-26 16:21:27 -05:00
api-routes-body-size-limit.md 5MB -> 4MB body size limit (#26887) 2021-07-02 23:17:56 +00:00
api-routes-static-export.md chore: Enable Alex documentation linting for error pages (#26526) 2021-06-23 23:33:58 -05:00
app-container-deprecated.md Prettier fix (#8754) 2019-09-16 15:24:42 +02:00
build-dir-not-writeable.md Update redirected or broken Vercel docs links. (#21119) 2021-01-14 15:37:21 +00:00
built-in-css-disabled.md Add warning when built-in CSS/SCSS support is disabled (#10942) 2020-03-10 14:29:40 -04:00
can-not-output-to-public.md chore: Enable Alex documentation linting for error pages (#26526) 2021-06-23 23:33:58 -05:00
can-not-output-to-static.md chore: Enable Alex documentation linting for error pages (#26526) 2021-06-23 23:33:58 -05:00
cant-override-next-props.md Update references to zeit/next.js (#13463) 2020-05-27 17:51:11 -04:00
circular-structure.md Remove trailing spaces (#6547) 2019-03-07 17:40:08 +01:00
client-side-exception-occurred.md Update client-side default error (#25997) 2021-06-11 16:23:45 +02:00
config-resolve-alias.md Update references to zeit/next.js (#13463) 2020-05-27 17:51:11 -04:00
conflicting-amp-tag.md Move syntax formatting to prettier (#7454) 2019-05-29 13:57:26 +02:00
conflicting-public-file-page.md docs: update links to docs site (#14305) 2020-06-18 09:54:07 +00:00
conflicting-ssg-paths.md Add proper error when conflicting paths are detected (#20918) 2021-01-11 20:50:17 +00:00
css-global.md Updated the Error message describing the alternative and added styles… (#14652) 2021-07-25 04:53:33 +00:00
css-modules-npm.md Update references to zeit/next.js (#13463) 2020-05-27 17:51:11 -04:00
css-npm.md docs(errors): CSS Imported by a Dependency (#10032) 2020-01-10 10:40:28 -05:00
custom-document-image-import.md Webpack rule to block importing images into _document (#28475) 2021-09-06 13:41:18 +02:00
custom-error-no-custom-404.md Warn when user has pages/_error but no pages/404 (#11603) 2020-04-05 13:19:14 +02:00
doc-crossorigin-deprecated.md Update references to zeit/next.js (#13463) 2020-05-27 17:51:11 -04:00
duplicate-sass.md Warn on duplicate Sass deps (#16398) 2020-08-20 16:05:29 +00:00
empty-configuration.md fix: 9919 Add warning when no config is exported from next.con… (#10228) 2020-01-29 09:12:30 +01:00
empty-object-getInitialProps.md fix broken link in error page (#10159) 2020-01-19 16:02:44 +01:00
env-key-not-allowed.md Block Certain Env Keys That Are Used Internally (#6260) 2019-02-15 17:49:40 +01:00
env-loading-disabled.md Enable .env support by default (#12911) 2020-05-15 14:02:16 -05:00
export-all-in-page.md fix typo in export-all-in-page (#15925) 2020-08-06 00:11:11 +00:00
export-image-api.md Update error message for next export and next/image. (#23061) 2021-03-15 13:01:12 -05:00
export-no-custom-routes.md Add warning when exporting with custom routes (#17538) 2020-10-05 07:11:06 +00:00
export-path-mismatch.md docs: update links to docs site (#14305) 2020-06-18 09:54:07 +00:00
future-webpack5-moved-to-webpack5.md chore: Enable Alex documentation linting for error pages (#26526) 2021-06-23 23:33:58 -05:00
generatebuildid-not-a-string.md Trim buildId returned from generateBuildId (#5634) 2018-11-12 15:57:48 +01:00
get-initial-props-as-an-instance-method.md docs: update links to docs site (#14305) 2020-06-18 09:54:07 +00:00
google-font-display.md ESLint Plugin: Google Font rules (#24766) 2021-05-10 10:03:28 +02:00
google-font-preconnect.md ESLint Plugin: Google Font rules (#24766) 2021-05-10 10:03:28 +02:00
gsp-redirect-during-prerender.md Add handling for redirects from getStaticProps/getServerSideProps (#16642) 2020-09-08 09:23:21 +02:00
gssp-component-member.md Fix typo in error markdown (#20825) 2021-01-07 10:22:43 +01:00
gssp-export.md Update gssp-export Error (#15529) 2020-07-27 18:47:00 +00:00
gssp-mixed-not-found-redirect.md Add test and errsh for mixed notFound/redirect error (#19076) 2020-11-11 22:02:11 +00:00
gssp-no-mutating-res Throw error if res is accessed after gSSP returns (#29010) 2021-09-13 17:10:46 -05:00
head-build-id.md Update instances of Now to Vercel where applicable (#13760) 2020-06-04 14:57:17 +00:00
href-interpolation-failed.md Add error when href interpolation fails (#16946) 2020-09-10 20:05:02 +00:00
import-esm-externals.md add support for esm externals (#27069) 2021-07-10 16:49:02 +00:00
improper-devtool.md Warn/revert custom devtool in development mode (#14285) 2020-06-24 04:15:57 +00:00
incompatible-href-as.md Update error when internal href and external as are used (#20658) 2021-01-01 12:14:42 -06:00
inline-script-id.md Add eslint rule for id attribute on inline next/script (#27853) 2021-08-19 20:08:04 +00:00
install-sass.md Improve Sass Error (#10982) 2020-03-11 16:34:14 -04:00
install-sharp.md Update install-sharp.md (#18508) 2020-10-30 10:56:11 -04:00
invalid-api-status-body.md Fix handling for 204 status code with a body (#28479) 2021-08-25 15:52:43 +00:00
invalid-assetprefix.md Add check for invalid assetPrefix (#9759) 2019-12-16 16:07:03 +01:00
invalid-dynamic-suspense.md Document usage of suspense option of next/dynamic (#28210) 2021-08-18 01:21:22 +00:00
invalid-external-rewrite.md Disallow basePath: false for internal routes (#15837) 2020-08-04 17:50:09 +00:00
invalid-getstaticpaths-value.md Remove unstable_ prefix from new methods (#10723) 2020-02-27 11:57:39 -06:00
invalid-getstaticprops-value.md feat: add type to previewData (#21574) 2021-04-20 18:13:48 +00:00
invalid-href-passed.md Fix invalid href error message (#17183) 2020-09-18 15:50:02 +00:00
invalid-i18n-config.md Document i18n locale limit (#27542) 2021-07-27 20:09:36 +00:00
invalid-images-config.md Add minimumCacheTTL config for Image Optimization (#27200) 2021-07-15 19:55:12 +00:00
invalid-multi-match.md Add err.sh for invalid multi-match usage (#9498) 2019-11-23 02:23:01 +01:00
invalid-page-config.md Handle cases where config is exported after its declaration (#16211) 2020-08-17 17:24:18 +00:00
invalid-react-version.md Add checking of react versions (#6892) 2019-04-04 16:47:17 -05:00
invalid-redirect-gssp.md docs: fix missing comma in invalid redirect gssp (#18580) 2020-10-31 23:37:06 -04:00
invalid-relative-url-external-as.md Update error when internal href and external as are used (#20658) 2021-01-01 12:14:42 -06:00
invalid-resolve-alias.md Update references to zeit/next.js (#13463) 2020-05-27 17:51:11 -04:00
invalid-route-source.md [Fix] common misspelling errors (#15288) 2020-07-19 04:38:20 +00:00
invalid-server-options.md Detailed error and warnings upon next() call (#13539) 2020-06-03 03:19:29 +00:00
invalid-webpack-5-version.md use webpack resolve api to resolve in externals config (#21205) 2021-01-17 20:02:20 +01:00
link-multiple-children.md Add helpful error for link with multiple children (#25657) 2021-05-31 19:41:57 +00:00
link-passhref.md ESLint Plugin: passHref is not assigned (#24670) 2021-05-10 18:35:11 +00:00
manifest.json Throw error if res is accessed after gSSP returns (#29010) 2021-09-13 17:10:46 -05:00
max-custom-routes-reached.md Add warning for large number of routes (#27214) 2021-07-16 14:59:54 +00:00
minification-disabled.md Prettier fix (#8754) 2019-09-16 15:24:42 +02:00
missing-document-component.md Improve Document Component Error (#17047) 2020-09-12 13:39:16 -04:00
missing-env-value.md Add initial process.env stubbing for new env support (#11893) 2020-04-15 02:42:37 -04:00
module-not-found.md Add Import trace for requested module when it fails to resolve (#27840) 2021-08-09 14:38:26 +02:00
multi-tabs.md Move syntax formatting to prettier (#7454) 2019-05-29 13:57:26 +02:00
nested-reserved-page.md Add warning when reserved pages are nested (#13449) 2020-05-27 16:45:53 +00:00
next-config-error.md Add proper error when failing to load next.config.js (#28099) 2021-08-14 13:52:18 +00:00
next-dynamic-modules.md Upgrade to Prettier 2 (#13061) 2020-05-18 15:24:37 -04:00
next-export-no-build-id.md Clear up production build missing message for next start and next export (#19777) 2020-12-08 15:16:56 +00:00
next-export-serverless.md Move syntax formatting to prettier (#7454) 2019-05-29 13:57:26 +02:00
next-head-count-missing.md Revert "Remove next-head-count (#16758)" (#18713) 2020-11-10 16:35:47 -05:00
next-image-missing-loader-width.md Rename next/image dangerously-unoptimized to custom and warn when applicable (#26998) 2021-07-08 19:35:19 +00:00
next-image-missing-loader.md Rename next/image dangerously-unoptimized to custom and warn when applicable (#26998) 2021-07-08 19:35:19 +00:00
next-image-unconfigured-host.md Update next-image-unconfigured-host.md (#24953) 2021-07-19 19:40:52 -05:00
next-script-for-ga.md chore(examples): switch to Script component on the google analytics example (#27674) 2021-09-08 21:03:23 +00:00
next-start-serverless.md chore: Enable Alex documentation linting for error pages (#26526) 2021-06-23 23:33:58 -05:00
no-cache.md [errors/no-cache] Prevent GitHub Actions cache from going stale (#27362) 2021-07-22 03:12:39 +00:00
no-css-tags.md Adds ESLint with default rule-set (#23702) 2021-04-30 11:09:07 +00:00
no-document-import-in-page.md ESLint Plugin: Fix Document and Head import rules (#25730) 2021-06-07 12:40:28 +02:00
no-document-title.md Add warning when viewport meta tag is added to _document.js (#13452) 2020-07-07 01:43:16 -04:00
no-document-viewport-meta.md Replace zeit/next.js with vercel/next.js (#20849) 2021-01-07 08:41:04 -05:00
no-duplicate-head.md adds no duplicate head rule (#27179) 2021-07-15 13:04:17 -05:00
no-head-import-in-document.md ESLint Plugin: Prevent bad imports of next/document and next/head (#24832) 2021-05-10 21:28:06 +00:00
no-html-link-for-pages.md Add docs for ESLint plugin settings and rule options (#28059) 2021-08-19 09:07:30 +00:00
no-img-element.md Fix minor typo in no-img-element.md (#29027) 2021-09-12 00:39:43 +00:00
no-on-app-updated-hook.md Update references to zeit/next.js (#13463) 2020-05-27 17:51:11 -04:00
no-page-custom-font.md fix typo in path (#24978) 2021-05-11 13:05:03 +02:00
no-router-instance.md expanded on No Router Instance (#21248) 2021-01-26 10:27:53 +00:00
no-script-in-document-page.md [ESLint] Disallow <Script /> inside _document.js & <Script /> inside the next/head component (#27257) 2021-08-13 23:16:15 +00:00
no-script-in-head-component.md [ESLint] Disallow <Script /> inside _document.js & <Script /> inside the next/head component (#27257) 2021-08-13 23:16:15 +00:00
no-sync-scripts.md Doc "no-sync-scripts" remove experimental notice (#26225) 2021-06-17 08:19:26 +00:00
no-title-in-document-head.md ESLint Plugin: Disallow <title> in Head from next/document (#24868) 2021-05-07 08:49:37 +00:00
no-unwanted-polyfillio.md Adds ESLint with default rule-set (#23702) 2021-04-30 11:09:07 +00:00
non-dynamic-getstaticpaths-usage.md Add error for getStaticPaths on non-dynamic page (#24188) 2021-04-18 09:31:40 +00:00
non-standard-node-env.md Better NODE_ENV explanation (#13476) 2020-05-28 09:10:22 +00:00
opt-out-auto-static-optimization.md docs: update links to docs site (#14305) 2020-06-18 09:54:07 +00:00
opt-out-automatic-prerendering.md docs: update links to docs site (#14305) 2020-06-18 09:54:07 +00:00
page-data-collection-timeout.md improve static generation UX (#27171) 2021-07-16 09:21:44 +00:00
page-without-valid-component.md fixed typo in page-without-valid-component.md (#15022) 2020-07-10 18:44:17 +00:00
placeholder-blur-data-url.md Fix typo in placeholder-blur-data-url error docs (#27510) 2021-07-26 17:04:47 +00:00
popstate-state-empty.md Remove unused error (#15748) 2020-07-31 17:29:09 +00:00
postcss-function.md PostCSS Error When Exporting Function (#10242) 2020-01-23 15:39:50 -05:00
postcss-ignored-plugin.md docs: use descriptive links instead of "click here" (#25897) 2021-06-09 13:23:16 -05:00
postcss-shape.md docs: use descriptive links instead of "click here" (#25897) 2021-06-09 13:23:16 -05:00
prefetch-true-deprecated.md chore: Enable Alex documentation linting for error pages (#26526) 2021-06-23 23:33:58 -05:00
prerender-error.md Add additional reason for the Prerender Error when running next export (#24828) 2021-05-06 14:51:53 +02:00
production-start-no-build-id.md Clear up production build missing message for next start and next export (#19777) 2020-12-08 15:16:56 +00:00
promise-in-next-config.md Upgrade to Prettier 2 (#13061) 2020-05-18 15:24:37 -04:00
public-next-folder-conflict.md Match public files priority in dev (#8641) 2019-09-16 23:06:30 +02:00
react-version.md Update react-version.md (#26093) 2021-06-14 20:24:36 +00:00
render-no-starting-slash.md Add warning when a page is rendered without a starting / (#11418) 2020-04-06 11:54:42 -05:00
reserved-page-prop.md Update url prop handling for pages with new data methods (#10653) 2020-02-26 13:26:55 -05:00
rewrite-auto-export-fallback.md De-experimentalize custom-routes (#14602) 2020-06-27 09:18:18 +00:00
routes-must-be-array.md De-experimentalize custom-routes (#14602) 2020-06-27 09:18:18 +00:00
sharp-missing-in-production.md Update docs for sharp usage to mention Vercel (#28476) 2021-08-24 22:51:28 +00:00
ssg-fallback-true-export.md Add error when exporting pages with fallback: true (#13063) 2020-05-19 09:29:34 -04:00
static-dir-deprecated.md chore: Enable Alex documentation linting for error pages (#26526) 2021-06-23 23:33:58 -05:00
static-page-generation-timeout.md use a shared worker pool for collecting page data and static page generation (#27924) 2021-08-12 19:54:49 +00:00
template.md Fix typo on "occured" to "occurred" (#26876) 2021-07-02 16:06:50 +00:00
threw-undefined.md Move syntax formatting to prettier (#7454) 2019-05-29 13:57:26 +02:00
undefined-webpack-config.md Error Message Clarity (#16052) 2020-12-01 15:58:52 -06:00
url-deprecated.md Remove unsupported examples (#26075) 2021-06-14 20:27:06 +02:00
webpack5.md Deprecate webpack 4 support (#28840) 2021-09-13 09:18:04 +02:00