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 err.sh for getStaticProps error #10619

Merged
merged 3 commits into from Feb 21, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions errors/invalid-getstaticprops-value.md
@@ -0,0 +1,17 @@
# Invalid unstable_getStaticProps Return Value

#### Why This Error Occurred

In one of the page's `unstable_getStaticProps` the return value had the incorrect shape.

#### Possible Ways to Fix It

Make sure to return the following shape from `unstable_getStaticProps`:

```js
export async function unstable_getStaticProps() {
return {
props: { [key: string]: any }
}
}
```
3 changes: 2 additions & 1 deletion packages/next/next-server/server/render.tsx
Expand Up @@ -246,7 +246,8 @@ const invalidKeysMsg = (methodName: string, invalidKeys: string[]) => {
return (
`Additional keys were returned from \`${methodName}\`. Properties intended for your component must be nested under the \`props\` key, e.g.:` +
`\n\n\treturn { props: { title: 'My Title', content: '...' } }` +
`\n\nKeys that need to be moved: ${invalidKeys.join(', ')}.`
`\n\nKeys that need to be moved: ${invalidKeys.join(', ')}.` +
`See here for more info: https://err.sh/zeit/next.js/invalid-getstaticprops-value`
)
}

Expand Down