Next.js Discord

Discord Forum

SSG page at build triggers serverless function

Unanswered
Asiatic Lion posted this in #help-forum
Open in Discord
Asiatic LionOP
I am trying to understand the Serverless Function invocations. In my app I have /app/[slug]/page.tsx when I do a build they are SSG pages. But when I load the page in prod and check the Vercel logs, it says that page is a serverless function and im guessing thats counting as my serverless function invocation limit/cost?

9 Replies

Asiatic LionOP
in the logs it does, but on build it says its SSG (white circle)
hm, i think thats because the requsted slug is not generated at build time, so it switches to dynamic rendering?
Asiatic LionOP
it is cause i see the slug on the build logs
try forcing the route to static and see if it changes something
export const dynamic = 'force-static'

in your page.tsx
Asiatic LionOP
ok
Asiatic LionOP
i think maybe its because its using generateStaticParams, but if the slug is not from build time it will still try to fetch the data, e.g. an admin in the CMS creates a new page after build.