Minimal Next.js Type Pollution Reproduction #79437
Unanswered
elitebot47
asked this question in
App Router
Replies: 1 comment 1 reply
-
Hi, This is rather, Next.js telling you that your function is not correct, and will cause issues. Next.js 15 introduced a breaking change where a few APIs became asynchrounous: https://nextjs.org/docs/app/guides/upgrading/version-15#asynchronous-page For the case you describe, Update your code to: export default async function ProfilePage({ params }: { params: Promise<{ username: string }> }) {
const session = await auth();
if (!session) {
return <div>Not authenticated , go to Signin page</div>;
}
const { username } = await params; // Don't forget this part!
// rest of implementation EDIT: I'll move this to a discussion thread instead |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Link to the code that reproduces this issue
https://github.com/elitebot47/social-media-app/blob/main/src/app/(main)/%5Busername%5D/page.tsx
To Reproduce
npm install
.npm run build
.{ params: { username: string } }
signature and there is noparams: Promise<...>
anywhere in the codebase.Current vs. Expected behavior
Bug: Type Pollution in Dynamic API Route Params
Error
Environment
Reproduction Steps
npm install
.npm run build
.{ params: { username: string } }
signature and there is noparams: Promise<...>
anywhere in the codebase.Example Dynamic API Route
Notes
.next
,node_modules
, andpackage-lock.json
and reinstalling.params: Promise<...>
usage is present in the codebase.Please advise on a fix or workaround. Thank you!
Provide environment information
Which area(s) are affected? (Select all that apply)
Not sure
Which stage(s) are affected? (Select all that apply)
next build (local)
Additional context
No response
Beta Was this translation helpful? Give feedback.
All reactions