Known Issues
Build Error with Undici
How to resolve the build error related to Undici when using localhost URLs in production environments.
Build Error with Undici
You may encounter a build error related to Undici when trying to deploy your Next.js application to a production environment. This issue typically occurs when using localhost
URLs in your production configuration.
The Problem
The error message might look something like this:
References
This issue on the next.js GitHub repository talks about it:
- https://github.com/vercel/next.js/issues/44062
- https://github.com/vercel/next.js/issues/44062#issuecomment-1445183293
Fix
To fix the issue, you need to ensure that the build environment doesn't have environment variables that point to localhost
. If they are, you need to change them to 127.0.0.1.