nextjs, mysql2, await is only valid in async functions error

Hi, I'm new to nextjs and drizzle and I'm getting this error when trying to insert and delete from a mysql db on a client connection. All my other await calls are wrapped in async functions so I'm fairly certain this is the cause of the error. When I switch to using a pool connection I no longer run into the issue but I'm not sure if that's the best way to go about doing it. Like I said I'm really new to this so if I could get some help/explanation for how this is supposed to work I'd really appreciate it
No description
4 Replies
Angelelz
Angelelz14mo ago
See the recommendation in the docs.
No description
ang
angOP14mo ago
Yeah that's what I did and it seems to work, but I'm running into the occasional too many connections error I guess the obvious fix would be to increase the pool size but is there anything else I should be doing to manage the pool?
ang
angOP14mo ago
Ooh that makes sense. I'll take a look at it thx a bunch
Want results from more Discord servers?
Add your server