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](https://cdn.answeroverflow.com/1168767771199426670/image.png)
4 Replies
See the recommendation in the docs.
![No description](https://cdn.answeroverflow.com/1168916420822839416/Screenshot_2023-10-31_101454.png)
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?
No, this is due to HMR. Take a look here: https://discord.com/channels/1043890932593987624/1043890932593987627/1141696708099711148
Ooh that makes sense. I'll take a look at it thx a bunch