'Nextjs router loading takes minutes

Good day, I have a simple nextjs app and it suddenly takes forever to load a single page. I inspected it and it seems that the router fetch is taking a long time (2 mins).. Not sure why.

First entry shows that the loading time is 2 minutes.1

Seems to only affect localhost? I have it on Vercel (live) and this does not happen.



Solution 1:[1]

I've solved it. It's not slow when deployed on Vercel. Also I made a mistake in returning all 300,000 documents under getStaticPaths, which should only be returning a smaller number of paths required at build time, as recommended by Vercel - https://vercel.com/docs/concepts/next.js/incremental-static-regeneration

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 gyinshen