Next.js dev server API routes/Server Actions hang on infinite loading when accessed via local IP

1 day ago 3
ARTICLE AD BOX

Your API/Server Action is likely calling localhost. But from your phone, localhost points to the phone, not your PC and this why your request hangs.

Solution:

Run Next dev server on all interfaces:

next dev -H 0.0.0.0 -p 3000

Use relative API URLs, not localhost.

Instead of

fetch("http://localhost:3000/api/github")

You should then try something like this

fetch("/api/github")
Read Entire Article