Unverified Commit 95071730 authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Add err.sh for getStaticProps error (#10619)

* Add err.sh for getStaticProps error

* Prettify error
Co-authored-by: 's avatarJoe Haddad <timer150@gmail.com>
parent b329f6a2
# 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 }
}
}
```
...@@ -45,7 +45,7 @@ const nextBuild: cliCommand = argv => { ...@@ -45,7 +45,7 @@ const nextBuild: cliCommand = argv => {
build(dir) build(dir)
.then(() => process.exit(0)) .then(() => process.exit(0))
.catch(err => { .catch(err => {
// tslint:disable-next-line console.error('')
console.error('> Build error occurred') console.error('> Build error occurred')
printAndExit(err) printAndExit(err)
}) })
......
...@@ -264,7 +264,7 @@ export default async function({ ...@@ -264,7 +264,7 @@ export default async function({
return results return results
} catch (error) { } catch (error) {
console.error( console.error(
`\nError occurred prerendering page "${path}" https://err.sh/zeit/next.js/prerender-error:`, `\nError occurred prerendering page "${path}" https://err.sh/next.js/prerender-error:\n` +
error error
) )
return { ...results, error: true } return { ...results, error: true }
......
...@@ -246,7 +246,8 @@ const invalidKeysMsg = (methodName: string, invalidKeys: string[]) => { ...@@ -246,7 +246,8 @@ const invalidKeysMsg = (methodName: string, invalidKeys: string[]) => {
return ( return (
`Additional keys were returned from \`${methodName}\`. Properties intended for your component must be nested under the \`props\` key, e.g.:` + `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\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(', ')}.` +
`\nRead more: https://err.sh/next.js/invalid-getstaticprops-value`
) )
} }
......
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