The middleware, next image optimizations, service worker, and next/tailwind config files are typically what cause a lot of the issues even if error messages are telling you otherwise. If things were working before the migration, it's almost guaranteed that it's not a problem with your code and that the next server configs need to be tweaked in some way.