Next.js Discord

Discord Forum

Please help me with this very simple question

Unanswered
Asiatic Lion posted this in #help-forum
Open in Discord
Asiatic LionOP
My index page has some very large queries that, according to the build output for "/", are supposed to be static, so they should only be executed once during the build.

The page doesn't have force-static.

However, I'm seeing Vercel function timeouts in the logs. Isn't this page supposed to be static?

I added force-static, and I think it solved the problem, but I still don't understand this behavior.

Could you explain why this was happening?

Thank you!

8 Replies

Asiatic LionOP
πŸ˜’
Asiatic LionOP
πŸ˜’
πŸ˜’
:S
:S
:S
@Asiatic Lion what version of next are you on? I don't think I know enough to help you with your problem but if you want to optimize your site and have as many things cached as possible, I recommend cache components if you are using a newer version of next
@Asiatic Lion My index page has some very large queries that, according to the build output for "/", are supposed to be static, so they should only be executed once during the build. The page doesn't have `force-static`. However, I'm seeing Vercel function timeouts in the logs. Isn't this page supposed to be static? I added `force-static`, and I think it solved the problem, but I still don't understand this behavior. Could you explain why this was happening? Thank you!
Yellow Wagtail
By adding force-static, you made the page render statically at build time. You mentioned the page performs some large queries. When you requested that page without force-static or generateStaticParams, it attempted to render the page dynamically, and since your queries take too long to execute, the Vercel function timed out.

I recommend optimizing and caching the query. Alternatively, you can use generateStaticParams to build the page at build time, or continue using force-static, as you were doing.