Unverified Commit 63e66ef0 authored by Joe Haddad's avatar Joe Haddad Committed by GitHub

Update `gssp-export` Error (#15529)

This pull request updates the `gssp-export` error for clarity.

Fixes #15527 
parent 56367487
......@@ -2,13 +2,37 @@
#### Why This Error Occurred
You attempted to export a page with `getServerSideProps` which is not allowed. `getServerSideProps` is meant for requesting up to date information on every request which means exporting it defeats the purpose of the method.
You attempted to statically export your application via `next export`, however, one or more of your pages uses `getServerSideProps`.
The `getServerSideProps` lifecycle is not compatible with `next export`, so you'll need to use `next start` or a [serverless deployment](https://vercel.com).
#### Possible Ways to Fix It
If you would like the page be static you can leverage the `getStaticProps` method instead.
1. If you'd like to keep your application static, you can use `getStaticProps` instead of `getServerSideProps`.
2. If you want to use server-side rendering, update your build command and remove `next export`. For example, in your `package.json`:
```diff
diff --git a/bla.json b/bla.json
index b84aa66c4..149e67565 100644
--- a/bla.json
+++ b/bla.json
@@ -1,7 +1,7 @@
{
"scripts": {
"dev": "next dev",
- "build": "next build && next export",
+ "build": "next build",
"start": "next start"
}
}
```
> **Note**: Removing `next export` does not mean your entire application is no longer static.
> Pages that use `getStaticProps` or [no lifecycle](https://nextjs.org/docs/advanced-features/automatic-static-optimization) **will still be static**!
### Useful Links
- [Automatic Static Optimization](https://nextjs.org/docs/advanced-features/automatic-static-optimization)
- [`getStaticProps` documentation](https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation)
- [`exportPathMap` documentation](https://nextjs.org/docs/api-reference/next.config.js/exportPathMap)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment