From db445db790a9a7038025a6847fc61cde9e977610 Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Thu, 20 Feb 2020 03:05:49 -0600 Subject: [PATCH] Add err.sh for invalid getStaticPaths return value (#10605) * Add err.sh for invalid getStaticPaths return value * Update error link * Apply suggestions from code review Co-authored-by: Tim Neutkens --- errors/invalid-getstaticpaths-value.md | 18 ++++++++++++++++++ packages/next/build/utils.ts | 4 +++- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 errors/invalid-getstaticpaths-value.md diff --git a/errors/invalid-getstaticpaths-value.md b/errors/invalid-getstaticpaths-value.md new file mode 100644 index 000000000000000..7f5412b2ff4d82e --- /dev/null +++ b/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 + } +} +``` + diff --git a/packages/next/build/utils.ts b/packages/next/build/utils.ts index 8d6aeeb096d3376..88ab4890ae34e99 100644 --- a/packages/next/build/utils.ts +++ b/packages/next/build/utils.ts @@ -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 ||