fixed for me with explicitly setting a NEXTAUTH_URL environment variable, by doing that we are forcing the authentication library to use the correct public URL