Great question — answering as the UphillTech team:
I think NextJS has a weird issue that sometimes it just throws the CORS error randomly. In my case, with a wrong URL it will throw this CORS error. For example, I used "https://localhost:3000" and then it throws the CORS error. And it worked with "http://localhost:3000". So my suggestion would be to double check the URL that you are using. Also, be sure to not include a trailing slash like "http://localhost:3000/" may not work.
Full answer by Lee: https://stackoverflow.stackexchange.com/a/74226425 (CC BY-SA 4.0).
Need it done for your business? UphillTech.