Skip to content

Commit

Permalink
fix: correctly mention generateStaticParams in error (#42524)
Browse files Browse the repository at this point in the history
Fixes #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)
  • Loading branch information
balazsorban44 committed Nov 6, 2022
1 parent 27159d0 commit 2578355
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/next/build/utils.ts
Expand Up @@ -828,13 +828,15 @@ export async function buildStaticPaths({
configFileName,
locales,
defaultLocale,
appDir,
}: {
page: string
getStaticPaths?: GetStaticPaths
staticPathsResult?: UnwrapPromise<ReturnType<GetStaticPaths>>
configFileName: string
locales?: string[]
defaultLocale?: string
appDir?: boolean
}): Promise<
Omit<UnwrapPromise<ReturnType<GetStaticPaths>>, 'paths'> & {
paths: string[]
Expand Down Expand Up @@ -982,7 +984,9 @@ export async function buildStaticPaths({
throw new Error(
`A required parameter (${validParamKey}) was not provided as ${
repeat ? 'an array' : 'a string'
} in getStaticPaths for ${page}`
} in ${
appDir ? 'generateStaticParams' : 'getStaticPaths'
} for ${page}`
)
}
let replaced = `[${repeat ? '...' : ''}${validParamKey}]`
Expand Down Expand Up @@ -1193,6 +1197,7 @@ export async function buildAppStaticPaths({
},
page,
configFileName,
appDir: true,
})
}
}
Expand Down

0 comments on commit 2578355

Please sign in to comment.