Next.js Discord

Discord Forum

TypeError: Fetch failed (Undici)

Unanswered
Flemish Giant posted this in #help-forum
Open in Discord
Flemish GiantOP
Hi guys!

So, I've been experiencing this frustrating issue with my Next.js project locally. I set up Next.js with Drizzle ORM / Kit, and I'm continuously running into this issue:

TypeError: fetch failed
    at Object.processResponse (node:internal/deps/undici/undici:7188:34)
    at node:internal/deps/undici/undici:7516:42
    at node:internal/process/task_queues:140:7
    at AsyncResource.runInAsyncScope (node:async_hooks:202:9)
    at AsyncResource.runMicrotask (node:internal/process/task_queues:137:8)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)


People appear to be resolving the issue by downgrading from the latest version of Next to an older canary version, or otherwise. But despite trying to do so, it appears no matter what version of Next.js I use, I run into the exact same issue.

Here is another variation:

 ⨯ TypeError: fetch failed
    at AsyncResource.runInAsyncScope (node:async_hooks:202:9)


My serverAction (yes, I have only set up one) is nothing out of the ordinary, it looks like so:

export async function createLead(values: createLeadSchemaType) {
  return await db.insert(lead).values(values);
}


And funnily enough, undici is nowhere to be found in my project, but I imagine it is a dependency used by Next. I've been wrangling with this problem all day, so would appreciate some help.

Thanks in advance!

0 Replies