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 invalid getStaticPaths return value #10605

Merged
merged 3 commits into from Feb 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
18 changes: 18 additions & 0 deletions errors/invalid-getstaticpaths-value.md
@@ -0,0 +1,18 @@
# Invalid unstable_getStaticPaths Return Value

#### Why This Error Occurred

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

#### Possible Ways to Fix It

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

```js
export async function unstable_getStaticProps() {
return {
paths: Array<string | { params: { [key: string]: string } }>
}
}
```

4 changes: 3 additions & 1 deletion packages/next/build/utils.ts
Expand Up @@ -562,7 +562,9 @@ export async function isPageStatic(

const staticPathsResult = await (mod.unstable_getStaticPaths as Unstable_getStaticPaths)()

const expectedReturnVal = `Expected: { paths: [] }`
const expectedReturnVal =
`Expected: { paths: [] }\n` +
`See here for more info: https://err.sh/zeit/next.js/invalid-getstaticpaths-value`

if (
!staticPathsResult ||
Expand Down