2020-02-27 18:57:39 +01:00
|
|
|
# Invalid getStaticProps Return Value
|
2020-02-21 06:45:50 +01:00
|
|
|
|
|
|
|
#### Why This Error Occurred
|
|
|
|
|
2020-02-27 18:57:39 +01:00
|
|
|
In one of the page's `getStaticProps` the return value had the incorrect shape.
|
2020-02-21 06:45:50 +01:00
|
|
|
|
|
|
|
#### Possible Ways to Fix It
|
|
|
|
|
2020-02-27 18:57:39 +01:00
|
|
|
Make sure to return the following shape from `getStaticProps`:
|
2020-02-21 06:45:50 +01:00
|
|
|
|
2022-04-05 20:59:58 +02:00
|
|
|
```ts
|
2020-03-01 15:20:28 +01:00
|
|
|
export async function getStaticProps(ctx: {
|
2022-04-05 20:59:58 +02:00
|
|
|
params?: ParsedUrlQuery;
|
|
|
|
preview?: boolean;
|
|
|
|
previewData?: PreviewData;
|
2020-03-01 15:20:28 +01:00
|
|
|
}) {
|
2022-04-05 20:59:58 +02:00
|
|
|
return {
|
|
|
|
props: { [key: string]: any }
|
|
|
|
}
|
2020-02-21 06:45:50 +01:00
|
|
|
}
|
|
|
|
```
|
2022-04-05 20:59:58 +02:00
|
|
|
|
|
|
|
### Useful Links
|
|
|
|
|
|
|
|
- [`getStaticProps` Documentation](https://nextjs.org/docs/api-reference/data-fetching/get-static-props)
|