Next.js Discord

Discord Forum

404 page not showing

Unanswered
Devon Rex posted this in #help-forum
Open in Discord
Devon RexOP
Hello,

I have a weird thing happening on my nextjs app (version 14.2.4).

I have this directory structure
/app
  [lng]/
    layout.tsx
    (group1)/
      page.tsx
      layout.tsx
    [partner]/
      page.tsx
      layout.tsx


the [partnerTheme]/page.tsx got export const dynamicParams = false; and the following function

export const dynamicParams = false;
export async function generateStaticParams() {
  const partner = await getPartner();

  let customPath = [
    ...partner.data.map((d) => ({ partner: d.uid })),
  ];

  return customPath;
}


Locally, it is correctly throwing a 404 page if the param does not exists, however, it does show the page without data on vercel.

Any idea?

Regards

6 Replies

Barbary Lion
Can you debug the return of getPartner on Vercel? Maybe it is unable to fetch the partner at build time?

Just add a log inside the getPartner function and look in the build logs at what is returned.
added the log there
export async function generateStaticParams() {
  const partner = await getPartner();

  let customPath = [
    { partner: 'abcd' },
    ...partner.data.map((d) => ({ partner: d.uid })),
  ];

  console.log('customPath', customPath);

  return customPath;
}
because [partner] is under the [lng] directory, shall I add lng as well into the mapping?
Devon RexOP
any ideas?
Barbary Lion
Can you create a sandbox?