My genuine answer to this is
Dot use Typeorm with NextJS
I also faced a lot of problems in setting up typeorm in NextJS. The thing is i somehow configured typeorm in my project, and it was working absolutely fine. But what happens is NextJS bundles the code in production build in very weired way. it dosent has teh same file structure as your source code. It is actually a good thing cause it helps in minification. But somehow typeorm relies on the folder structure of your project.
So what happens is you project wil work in development mode but it will fail in the production build.
So yeah, dont use TypeORM with NextJS. Use Prisma... ;-)