Next.js Discord

Discord Forum

Server Actions on Vercel and Drizzle Prepared Statements

Unanswered
Kurilian Bobtail posted this in #help-forum
Open in Discord
Kurilian BobtailOP
So I have implemented my own little rate-limiting middleware with drizzle + sqlite that I run on each server action (I use the next-safe-action library to add the middleware to my server functions, not to be confused with a normal nextjs middleware). So for performance reasons I wondered if it would make sense if the query was a prepared statement but I can't really wrap my head around the serverless aspect of of server actions. Is each server action its own lambda or do multiple get bundled together (if so, do I have control over that?)? If each of them were their own lambda, then how long will those be kept warm? I am asking since from my understanding creating a prepared statement only makes sense if sufficiently many requests actually go through the same prepared statement. Edit: Furthermore which runtime (edge, node) is actually used in my server actions and how do I control that?

0 Replies