Something very strange
Unanswered
Birman posted this in #help-forum
BirmanOP
Hey guyz, something really strange happens with our saas. Our frontend is on nextjs and have a seprrate backend.
What happens is , when i switch between pages , the browser request itslef gets cameclled and it never reached to frontebd server and it takes k a lot of time. And in 10 seconds we have a timeout timer so frontejd reloads its oage again and then it shows the nnaviagted page.
What happens is , when i switch between pages , the browser request itslef gets cameclled and it never reached to frontebd server and it takes k a lot of time. And in 10 seconds we have a timeout timer so frontejd reloads its oage again and then it shows the nnaviagted page.
32 Replies
@B33fb0n3 Are you using iconify?
BirmanOP
No, it uses react-icons and lucide icons
I will send a video of how our saas gets chocked. You will underdtand it better. When i ask this from ai, it says rrquests gets stalled connection before teaching to frontend server.
BirmanOP
hey this is it, we got exact suitation at last which i stated is , randomly when i switch between pages, it stalls request . in frontend i have set reloading timer for 4 seconds. so if request doesnt complete in 250ms or takes longer than 4seconds. the nextjs then refresh the page.
but this is how its happening, did you got some clue ? @B33fb0n3
but this is how its happening, did you got some clue ? @B33fb0n3
oops, file exceeds more than 140 mb.
where are you hosting?
Rafeiro do Alentejo
Cut off the other components first then reattach it one-by-one to see which one does the bottleneck or to identify race..
@B33fb0n3 where are you hosting?
BirmanOP
vercel pro
@Birman vercel pro
do you have credentials to be able to login to test ourselfs?
@B33fb0n3 do you have credentials to be able to login to test ourselfs?
BirmanOP
Yes please,
app.gymforce.in
Email : admin@gymforce.in
Password: Rrrrp1955@
app.gymforce.in
Email : admin@gymforce.in
Password: Rrrrp1955@
Pls try.
I have built majority of this using AI.
@Birman Yes please,
app.gymforce.in
Email : admin@gymforce.in
Password: Rrrrp1955@
thanks for sharing! I couldnt reproduce the error by navigating on the page directly. As you using AI, AI produces a lot of slop and side effects that have nearly nothing todo with the implemented features and those side effects are pretty hard to find. Even when you have the full code. I saw you are on version 14.2.35. You might want to upgrade to 16.X.X and see if that fixes the issue. Thats alr often the case. Do NOT use cache components as that requires a good amount of skill to understand how nextjs caching works and where to do what.
So if I would be you:
1. upgrade to 16.X.X (watch out for CVEs)
2. check breaking changes in your app
3. fix breaking changes if any
4. test behavior
5. let discord thread know the result
So if I would be you:
1. upgrade to 16.X.X (watch out for CVEs)
2. check breaking changes in your app
3. fix breaking changes if any
4. test behavior
5. let discord thread know the result
Rafeiro do Alentejo
I have already foreseen what he did base on the first question eh. No profiling, debuggers, tests, validation, etc. So I suggested to remove the components one by one first..
@Birman hows it going?
@B33fb0n3 <@514110680740134923> hows it going?
BirmanOP
Hey, Thanks for asking.
I upgraded to 16.X Next version, so far things working good but i still saw the same broken flow few times. i am still not convinced if upgrading to latest nextjs version could have solved this on its own. i see this as a code problem itself cuz request gets stalled at browser , it never hits to frontend.
can you adviced me how exactly i find breaking behavior?
I upgraded to 16.X Next version, so far things working good but i still saw the same broken flow few times. i am still not convinced if upgrading to latest nextjs version could have solved this on its own. i see this as a code problem itself cuz request gets stalled at browser , it never hits to frontend.
can you adviced me how exactly i find breaking behavior?
my only pov is , if i route to any page. the frontend should be loaded in a snap. as frontend then calls API via axios and then backend does its job and then frontend renders that response accoridngly. but what currenlty happens is frontend itself doesnt loads and if it doesnt load in 4 seconds , code launches a refresh. i hope i am clear here.
BirmanOP
For example : when i navigated to one route , it again got stcuk in loading and after 10 secnds, when it refreshes the page , this is what it shows in network tabs.
@Birman For example : when i navigated to one route , it again got stcuk in loading and after 10 secnds, when it refreshes the page , this is what it shows in network tabs.
tbh, when I testing it, then I never experienced issues. And when its stalled, then its mostly the browser itself. Maybe due to low ram, or other reasons because of the device. As I havent experienced the issue on my device it kinda confirms that... Can you test on a different device?
@B33fb0n3 tbh, when I testing it, then I never experienced issues. And when its stalled, then its mostly the browser itself. Maybe due to low ram, or other reasons because of the device. As I havent experienced the issue on my device it kinda confirms that... Can you test on a different device?
BirmanOP
Hey, i checked through my mobile phone, and it does happen there as well. i will now soon also test on other laptop machine with maybe different network.
@Birman Hey, i checked through my mobile phone, and it does happen there as well. i will now soon also test on other laptop machine with maybe different network.
Thanks for keeping us updated! I tested it by navigating a lot of pages in a short amount of time. I guess that’s what I saw in your video as well
@B33fb0n3 Thanks for keeping us updated! I tested it by navigating a lot of pages in a short amount of time. I guess that’s what I saw in your video as well
BirmanOP
Did you saw that specific toast that says " loading page " and then "its taking longer ... " and then whole.page gets refreshed.
I mean what could be the cause here cuz in network i get imitiall connection takes all the time and this happens very randomly. Theres no specific page or flow where i can keep reproducing it.
I mean what could be the cause here cuz in network i get imitiall connection takes all the time and this happens very randomly. Theres no specific page or flow where i can keep reproducing it.
@Birman Did you saw that specific toast that says " loading page " and then "its taking longer ... " and then whole.page gets refreshed.
I mean what could be the cause here cuz in network i get imitiall connection takes all the time and this happens very randomly. Theres no specific page or flow where i can keep reproducing it.
nah, I never got "loading page" or "its taking longer ..." and I kept the network tab open to check for broken connections: none found
@Birman Yes please,
app.gymforce.in
Email : admin@gymforce.in
Password: Rrrrp1955@
pls make sure to reset the credentials once your issue is resolved
@Anay-208 pls make sure to reset the credentials once your issue is resolved
BirmanOP
its not yet resolved but yeah thanks for mentioning it.
American black bear
This usually happens when a middleware.ts fetch or a root layout.tsx API call blocks the Next.js RSC payload during navigation, causing the browser to abort/hang until your 10s fallback triggers a hard reload. Check your Network tab for hanging _rsc requests or middleware latency—happy to take a quick look at your setup if you're still stuck.
@American black bear This usually happens when a middleware.ts fetch or a root layout.tsx API call blocks the Next.js RSC payload during navigation, causing the browser to abort/hang until your 10s fallback triggers a hard reload. Check your Network tab for hanging _rsc requests or middleware latency—happy to take a quick look at your setup if you're still stuck.
BirmanOP
Yeah issue is still there. What you want from me to look?
American black bear
To pinpoint the exact bottleneck quickly, could you share a few things?
Network Tab info: A quick screenshot or detail of what the Network tab shows when the navigation hangs (specifically which request is pending/canceled).
middleware.ts: If you're using a middleware for auth or API routing, paste its content.
Root Layout (app/layout.tsx): The code where you handle top-level data fetching or providers.
next.config.js: If you are using rewrites/proxies to route to your separate backend.
Drop these here, and I'll tell you right away what's causing the freeze.
Network Tab info: A quick screenshot or detail of what the Network tab shows when the navigation hangs (specifically which request is pending/canceled).
middleware.ts: If you're using a middleware for auth or API routing, paste its content.
Root Layout (app/layout.tsx): The code where you handle top-level data fetching or providers.
next.config.js: If you are using rewrites/proxies to route to your separate backend.
Drop these here, and I'll tell you right away what's causing the freeze.
BirmanOP
1. Network Tab info with screenshots attached below.
2. src/middleware.ts : https://pastecode.io/s/wa5q7k0m
3. src/app/[locale]/layout.tsx (root layout): https://pastecode.io/s/xe7bfuv2
4. next.config.mjs: https://pastecode.io/s/u9r0ht3b
I hope here is everything answered.
Also i had Claude try looking for this and it did something as a fix but the issue is still there , so this is what a summary i want to share if somebody wants to look : https://pastetext.pro/f4ab4c
@American black bear Thank you
2. src/middleware.ts : https://pastecode.io/s/wa5q7k0m
3. src/app/[locale]/layout.tsx (root layout): https://pastecode.io/s/xe7bfuv2
4. next.config.mjs: https://pastecode.io/s/u9r0ht3b
I hope here is everything answered.
Also i had Claude try looking for this and it did something as a fix but the issue is still there , so this is what a summary i want to share if somebody wants to look : https://pastetext.pro/f4ab4c
@American black bear Thank you