Next.js Discord

Discord Forum

Vercel as a host

Answered
Barbary Lion posted this in #help-forum
Open in Discord
Avatar
Barbary LionOP
Y’all think vercel is good as a host if I were to upgrade to the pro plan? I’m currently hosting a site on the free plan with an admin backend, a login system, user dashboard, and a generic site with an auto playing video in the hero. I noticed it’s gotten quite slow, not sure if it’s something to do with nextauth or something but it seems like it’s slowed down significantly since I added it. Either way looking for some advice on how to go forward with hosting because I can’t have users not even be able to navigate. Will dm the site if anyone’s interested in seeing for themselves.
Answered by Yi Lon Ma
vercel is the best but you can try netlify
View full answer

26 Replies

Avatar
Barbary LionOP
My question I guess is: is vercel a good host with the $20 plan or should I look elsewhere.
Avatar
I don't think upgrading will fix the speed issues
Avatar
Barbary LionOP
I feel like it’s the host that’s the issue because it runs extremely smoothly in my development environment but just shits the bed in production.
Avatar
the reason could be that your db is in another region than your host
or something of that sort
Avatar
Barbary LionOP
Possibly, but It’s in the same region. I also don’t believe that would be affecting initial page load for the homepage, and the fact that it takes a solid 5-10 seconds to change to different pages even when not logged in or anything
I had 3 other friends test it, one said it was quick and 2 also said it was extremely slow.
So I’m just not really sure, maybe I’ll run the trial for the pro plan I believe I just saw that or at worst I waste $20. Either way not the biggest deal.
Any other host recommendations that work well with nextjs?
Avatar
vercel is the best but you can try netlify
Answer
Avatar
Barbary LionOP
Sounds good I’ll check it out, appreciate it!
Avatar
It should very fast even the free plan. @Barbary Lion

- What db provider are you using?
- where are you checking next-auth session?
- Using JWT or database session?
- feel free to dm link to try
Avatar
Barbary LionOP
Ended up removing the async from the layout function and it is not lagging anymore, but that means I can’t put my session provider component wrapping my other components. I’m using mongo with jwt
So I guess I just need to figure out how to get the session without making the layout async
Avatar
Making the layout async and checking the session there is fine and common practice, there’s no need to avoid it.

Try debugging the await calls and see which one is slow, if possible paste the code too
Avatar
Barbary LionOP
Not on my pc atm but I’ll definitely send the code soon. I was awaiting the server session to pass to the session provider that wrapped the rest of my code, so that’s the only thing that could have been holding it back but it seems like a different issue if I’m unable to proceed with normal functionality of things like buttons even if they’re showing.
I believe I tried removing the await for the server session as well and it was still extremely slow and the app didn’t work
Avatar
When using JWT it should be instantaneous, when running locally and connecting to production db is also slow?
Avatar
Barbary LionOP
Nope, runs nice and smoothly on my local build. But I do have a way to contact us and it just adds their message to my database, and when testing just now it took extremely long.
I’m a little new with jwt some I’m not too familiar with how it works and what not, nextauth included.
I feel like nextauth is fairly simple once it’s setup based on what I’ve seen so far, it’s just this slow loading times that I can’t seem to fix in production.
Could possibly be the database speeds
I’m using mongodb atlas’ free cluster, might look into a different database if there’s something quick that’s relatively cheap or free if you have any suggestions.
Avatar
double check that the database region and the region the Vercel project is deployed to is the same or close geographically. You can see it in the Vercel dashboard project under Settings -> functions
The website you linkedin is fast, so Vercel is definitely not a problem.
Please share the code where you did the session check