-
Notifications
You must be signed in to change notification settings - Fork 27k
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
[appDir] Development Server throws Error: Dynamic server usage: previewData when using generateStaticParams with previewData from next/headers #43392
Comments
…rams and appDir (#43395) fixes #43392 <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change that you're making: --> ## Bug - [x] Related issues linked using `fixes #number` - [x] Integration tests added - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/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` - [] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) 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`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Documentation / Examples - [x] 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) Co-authored-by: JJ Kasper <jj@jjsweb.site>
This exact bug occurs with the next-auth It works perferctly fine in production mode, however development mode thows the // src/app/[auth]/layout.tsx
import { unstable_getServerSession } from "next-auth/next"
import { ReactNode } from "react"
interface LayoutProps {
params: {
auth: string
}
children: ReactNode
}
export default async function Layout({ params, children }: LayoutProps) {
// ...
const session = await unstable_getServerSession()
// ...
return children
}
export async function generateStaticParams() {
return [{ auth: "login" }, { auth: "register" }]
} |
Still the same in 2023 |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Verify canary release
Provide environment information
What browser are you using? (if relevant)
Firefox 107.0
How are you deploying your application? (if relevant)
Vercel
Describe the Bug
Using
generateStaticParams
withpreviewData()
will throw an error in development mode. It works fine in production.Expected Behavior
We should be able to preview a statically generated page with
previewData
since this call does not make the page dynamic as callingcookies
andheaders
does.Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster
https://github.com/brvnonascimento/next-13-preview-data-error
To Reproduce
yarn dev
Dynamic server usage: previewData
yarn build && yarn start
or visit the deployed version on VercelThe text was updated successfully, but these errors were encountered: