Skip to content
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

[BUG] Nextjs SSG not worked. #58

Open
alex-guoba opened this issue Jan 11, 2024 · 0 comments
Open

[BUG] Nextjs SSG not worked. #58

alex-guoba opened this issue Jan 11, 2024 · 0 comments

Comments

@alex-guoba
Copy link

when I was building the project, I found that Next SSG not worked. sub pages wasn't builded success.

Route (app)                                Size     First Load JS
┌ ○ /                                      551 B          84.7 kB
└ ● /article/[slug]                        428 B          84.6 kB
+ First Load JS shared by all              78.4 kB
  ├ chunks/596-ce7e8c7c8d41c1a3.js         26 kB
  ├ chunks/fd9d1056-a99b58d3cc150217.js    50.5 kB
  ├ chunks/main-app-f318128f92979073.js    219 B
  └ chunks/webpack-6c6a017659fdd40a.js     1.7 kB

So I noticed that there was something wrong in the generateStaticParams function. when geting the sulg name, the fields was not exist.

// Return a list of `params` to populate the [slug] dynamic segment
export async function generateStaticParams() {
  const database = await getDatabase();
  return database?.map((page) => {
    const slug = page.properties.Slug?.**formula**?.string; // field error
    return ({ id: page.id, slug });
  });
}

I don't know the reason, may notion have upgrade the database definition. so I replaced it with this sentense:

const slug = page.properties.Slug?.rich_text[0].plain_text;

It seems worked.

Route (app)                                Size     First Load JS
┌ ○ /                                      551 B          84.7 kB
└ ● /article/[slug]                        428 B          84.6 kB
    ├ /article/another-blogpost
    ├ /article/hello-world-title
    └ /article/powered-by
+ First Load JS shared by all              78.4 kB
  ├ chunks/596-ce7e8c7c8d41c1a3.js         26 kB
  ├ chunks/fd9d1056-a99b58d3cc150217.js    50.5 kB
  ├ chunks/main-app-f318128f92979073.js    219 B
  └ chunks/webpack-6c6a017659fdd40a.js     1.7 kB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant