T
TanStack•2mo ago
correct-apricot

Delay Loading Page on Vercel

This isn't something I notice when I'm running in development mode. But when we deploy to Vercel, the first time we load the app, or any time we try to refresh (so I guess any time it goes to the server for a route), we get a 10 second delay before everything rushes in. I'm struggling to debug it because I don't really get any logs. I've got a suspicion it could be to do with Clerk because there is a route that is not authenticated, and I don't think it's having the same issue, but it also doesn't do a lot. There's nothing in the browser recording of the requests because it's all in the single request to that route, not in any of the server function calls. the browser just sort of sits on a white page for 10 seconds and then everything rushes in as it does the extra calls. Has anyone experienced anything like this or have any sort of suggestions on where I could start to look?
12 Replies
harsh-harlequin
harsh-harlequin•2mo ago
did you configure a 10 sec timeout anywhere? or could it be the default for clerk? cc @wobsoriano try building locally for node server and see if it happens as well
correct-apricot
correct-apricotOP•2mo ago
There's nothing I can see with a 10 sec timeout. I'm not seeing anythign fail either, it just seems to hang and then completes just fine, but after the wait. It's quite odd. That's a good idea, i'll try that now. I removed the vercel target so I could run it locally and I don't see the same issue from the prod build. Only difference I guess is dev vs prod clerk as I can't talk to production from localhost I need to use the dev instance. I would hope they are the same.
harsh-harlequin
harsh-harlequin•2mo ago
why cant you use prod clerk locally?
correct-apricot
correct-apricotOP•2mo ago
Clerk: Production Keys are only allowed for domain "xxx"
optimistic-gold
optimistic-gold•2mo ago
hey Im on paternal leave 😅 , if you think this is a Clerk issue feel free to join our Discord and open a support thread there! Also, are you running on RC version of tanstack start?
correct-apricot
correct-apricotOP•2mo ago
Congratulations! Ok, will do. Yes I think I am, it's quite recently I updated it all
optimistic-gold
optimistic-gold•2mo ago
And you are using the snapshot version of @clerk/tanstack-react-start right? Since the current one only works on pre-RC of tanstack
correct-apricot
correct-apricotOP•2mo ago
"@tanstack/react-start": "^1.131.28" "@clerk/tanstack-react-start": "^0.23.1" So it does look like I'm a little behind
optimistic-gold
optimistic-gold•2mo ago
yeah okay so try to update your tanstack dependencies, and use this version of Clerk tanstack https://github.com/clerk/javascript/pull/6859
correct-apricot
correct-apricotOP•2mo ago
I'll give that a go, thank you!
optimistic-gold
optimistic-gold•2mo ago
how was it?
correct-apricot
correct-apricotOP•2mo ago
Doesn't seem to have had an impact It seems to be that even though I had SPA mode on, it was still server side rendering. Clearly I don't really understand how it's working, so I'll need to go back to the docs. What has worked there is setting ssr to false at the root route. I'll need to work out how to debug why server-side rendering takes 10 seconds on Vercel at some point. But for now, I don't really need it anyway.
My suspicion of Clerk was clearly wrong. It was more that that page was basically not doing anything, I guess, that led me down the garden path a bit.

Did you find this page helpful?