Next.js Discord

Discord Forum

Common pitfalls to check for slow NextLink loading

Unanswered
Rose-breasted Grosbeak posted this in #help-forum
Open in Discord
Rose-breasted GrosbeakOP
Hi, I'm a newbie in NextJs (familiar with react). I got an assignment from my employer to improve a next app's performance.
I'm learning NextJs currently, though, I'd be great if someone could list out some common bottlenecks.

The project is using Next13.4 (app/ directory). Redux, Chakra-UI.
When clicked on a NextLink, it makes a 2-network request chain to completely load the page. This takes a lot of time in a production server. but it's pretty fast in dev mode.

I'm also getting this weird error in logs in dev mode when I run the webapp.
error Error: child failed: path argument was an invalid path = "/services/service_centers/verified/driving_school/dev-sw.js". Paths must be non-empty strings and can't contain ".", "#", "$", "[", or "]"
    at Module.generateMetadata (./app/[ds_id]/page.tsx:19:144)
null


Note: The initial loading is fine. Only NextLink has the issue

9 Replies

@Eric Burel (just guessing you may want to share some code)
Rose-breasted GrosbeakOP
The code base is huge. I'll take some time making a minimal example
@Eric Burel Is there a middleware in your app?
Rose-breasted GrosbeakOP
I don't think so
@Eric Burel This path is suspicious to me it loads a service worker, but not from the route
Rose-breasted GrosbeakOP
True, but strangely there's no service worker registered in production
Thanks for your insights.
The bug is not the priority though
Rose-breasted GrosbeakOP
Well it is firebase/gcp with its primitive server response times.