Next.js Discord

Discord Forum

Error: No more than 12 Serverless Functions

Answered
smas7581 posted this in #help-forum
Open in Discord
Guys what i can do here to avoid this error?
Answered by smas7581
i didnt put them all in one big api route but forged some of them in just one file and looks like it solved the problen
View full answer

50 Replies

You would need to provide the error πŸ™‚
Your joking right?
Error: No more than 12 Serverless Functions can be added to a Deployment on the Hobby plan. Create a team (Pro plan) to deploy more. Learn More: https://vercel.link/function-count-limit


If the entire error was provided, it would have been a much more concise and easily answerable question, well it was easily answerable either way... but teaching someone to fish properly is more important than giving them the fish
@Jboncz gotcha , next time I will provide the full context . I'm a rookie guy on programming, what's a serverless function ?
No worries bud. Soooo, it has to do with vercel, so im not 100% sure BUT I THINK... if you structured your api routes to be more... 'bundleable' it would fix this?
Essentially, try putting your individual endpoints in /api/ into folders
If your more interested in learning best practices for rest api's I would give https://swagger.io/resources/articles/best-practices-in-api-design/ a read
I will read that. You think chatgpt would help me on this matter too ?
I have no idea bud, ive never used it to help with nextjs/vercel specific things.
as a really easy first troubleshooting step I would try putting these in a folder
name is misc or something just to test it
Sure I will try that , thanks
Why did you decide to use the pages router instead of the app router? if you dont mind me asking.
@Jboncz because I saw a YouTube video
The guys choose that instead of app router
Ahhhh. The dreaded youtube video πŸ˜„
I don't even know the difference between them
My knowledge at programming it's really low
Hmmm. Pages is 'old' but still going to be supported for quite awhile, and app router is 'new'.
Still learning slowly
I would highly recommend stepping through https://nextjs.org/learn
I can't remember the video but the guy said app router is buggy
Isn't it recent ?
It was likely an older video, when it first came out I was of the same mind, but its much much better. Recent as in... I think 2 years old at this point.
dont quote me
Thanks πŸ™
May 4th 2023 was when nextjs 13.4 released as 'stable'.
Original message was deleted
When you figure out if your issue is resolved make sure to mark a solution or provide what you did to solve the issue to help others having the same issue in the future
wait what
this is cooked
my tiny little site already has 6
welp ig my opennext migration is happening sooner than I thought
@Jboncz as a really easy first troubleshooting step I would try putting these in a folder
I think if @smas7581 puts them all in one big api route then have a param to toggle between them, you can have all 12 in one "function"
just make sure you don't hit the size limit of 25 mb
oh wait, apparently there's no limit on the number of edge functions
@Lukas I think if <@841388592441720873> puts them all in one big api route then have a param to toggle between them, you can have all 12 in one "function"
i didnt put them all in one big api route but forged some of them in just one file and looks like it solved the problen
Answer
@Jboncz @Lukas after rsolving that error im getting this one
this is the lib/db.ts
or shall i create a new post
yea maybe you should make a new post
also you don't need use server for a server component
use server = server action
use client = client component
import "server-only" = server code/component (not needed)
but when i delete "user server" gives me other error like Cant find module something"NET" and i searched it online and saw that i needed to use "use server"