Does not satisfy the constraint 'PageProps'

  1. Hi, So im new to NextJS, and im working on some few pages, and I keep getting errors when deploying to Vercel, the error is:
Failed to compile.
app/[lang]/about-us/page.tsx
Type error: Type '{ params: { lang: string; }; }' does not satisfy the constraint 'PageProps'.
  Types of property 'params' are incompatible.
    Type '{ lang: string; }' is missing the following properties from type 'Promise<any>': then, catch, finally, [Symbol.toStringTag]
Error: Command "npm run build" exited with 1

while locally it works, The page in question is:

type Props = {
  params: Promise<{ lang: string }>;
};

export default async function Page(props: Props) {
  const { lang } = await props.params;
  const dict = await getDictionary(lang);

  return (
    <div dir={lang === 'ar' ? 'rtl' : 'ltr'} className="bg-gray-50 min-h-screen">
      <Navigation lang={lang} />
      <main className="py-16">
        <section className="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8">
          <h1 className="text-4xl font-bold text-gray-800 mb-6">
            {dict.pages.aboutUs.title}
          </h1>
          <p className="text-lg text-gray-600">
            {dict.pages.aboutUs.description}
          </p>
        </section>
      </main>
      <Footer lang={lang} />
    </div>
  );
}

I am confused. Please help, not to mention, i am checking the source, and its not matching with Github, even when it shows the commit that was pulled, but the files are not matching, am i missing something?

iam also getting same errors…src/app/(services)/[service_name]/[state]/[city_name]/page.tsx Type error: Type 'Props' does not satisfy the constraint 'PageProps'. Types of property 'params' are incompatible. Type '{ service_name: string; state: string; city_name: string; }' is missing the following properties from type 'Promise<any>': then, catch, finally, [Symbol.toStringTag] ELIFECYCLE Command failed with exit code 1. Error: Command "pnpm run build" exited with 1 are you using nextjs 15?

Please don’t use blatantly obvious GPT answers that are completely wrong in order to “help” people - this causes even more problems to begin with. Using AI tools to brainstorm or verify ideas is convenient, but only rely on it, let alone share it, once you’re yourself sure they are correct. In this case Next v15 has introduced async params which GPT doesn’t know about yet which causes it to hallucinate.

1 Like

Would you mind sharing the code from that particular page file? Chances are, you forgot to make the params async which is required since Next v15.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.