Skip to content

Commit 2578355

Browse files
fix: correctly mention generateStaticParams in error (vercel#42524)
Fixes vercel#42517 Not sure if it warrants a test case, but let me know if I should add one. ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
1 parent 27159d0 commit 2578355

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/next/build/utils.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,13 +828,15 @@ export async function buildStaticPaths({
828828
configFileName,
829829
locales,
830830
defaultLocale,
831+
appDir,
831832
}: {
832833
page: string
833834
getStaticPaths?: GetStaticPaths
834835
staticPathsResult?: UnwrapPromise<ReturnType<GetStaticPaths>>
835836
configFileName: string
836837
locales?: string[]
837838
defaultLocale?: string
839+
appDir?: boolean
838840
}): Promise<
839841
Omit<UnwrapPromise<ReturnType<GetStaticPaths>>, 'paths'> & {
840842
paths: string[]
@@ -982,7 +984,9 @@ export async function buildStaticPaths({
982984
throw new Error(
983985
`A required parameter (${validParamKey}) was not provided as ${
984986
repeat ? 'an array' : 'a string'
985-
} in getStaticPaths for ${page}`
987+
} in ${
988+
appDir ? 'generateStaticParams' : 'getStaticPaths'
989+
} for ${page}`
986990
)
987991
}
988992
let replaced = `[${repeat ? '...' : ''}${validParamKey}]`
@@ -1193,6 +1197,7 @@ export async function buildAppStaticPaths({
11931197
},
11941198
page,
11951199
configFileName,
1200+
appDir: true,
11961201
})
11971202
}
11981203
}

0 commit comments

Comments
 (0)