Next.js Discord

Discord Forum

Next.js 13 redirect giving timeout error.

Unanswered
SID posted this in #help-forum
Open in Discord
SIDOP
I am using a server side form in nextjs 13 and when I submit the form I am hitting /api/some-route
and in that route I am using next navigation to redirect the user to some other page of the application,
I am getting this
` { cause: HeadersTimeoutError: Headers Timeout Error at Timeout.onParserTimeout [as callback] (node:internal/deps/undici/undici:9748:32) at Timeout.onTimeout [as _onTimeout] (node:internal/deps/undici/undici:8047:17) at listOnTimeout (node:internal/timers:573:17) at process.processTimers (node:internal/timers:514:7) { code: 'UND_ERR_HEADERS_TIMEOUT' } ``` It keeps loading for some time and then gives this error. this is my router ``` import { redirect } from "next/navigation"; export async function POST(request: Request, response: Response) { redirect(/some/route`);
}
```

0 Replies