Next.js Discord

Discord Forum

App Router, Dynamic routes try to create a new mariadb pool when one is already created

Answered
Saltwater Crocodile posted this in #help-forum
Open in Discord
Saltwater CrocodileOP
This only happens in dynamic routes, not sure why, and it doesn't seem to share global variables, because i am storing the already created pool in a variable, this variable is undefined when calling dynamic routes, tries to create a new pool and fails to do so.
Answered by Saltwater Crocodile
Fixed!

This is the final code, instead of trying to have a global variable all i have to do is check if !pool create new pool
View full answer

2 Replies

Saltwater CrocodileOP
Saltwater CrocodileOP
Fixed!

This is the final code, instead of trying to have a global variable all i have to do is check if !pool create new pool
Answer