Fetch failed when building the app
Answered
Arboreal ant posted this in #help-forum
Arboreal antOP
Generating static pages (0/12) [ ]
TypeError: fetch failed
at node:internal/deps/undici/undici:12345:11
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async globalThis.fetch (C:\Users\...\frontend\.next\server\chunks\638.js:1:36415)
at async p (C:\Users\...\frontend\.next\server\app\page.js:1:24795)
at async m (C:\Users\...\frontend\.next\server\app\page.js:1:24901) {
cause: AggregateError
at internalConnectMultiple (node:net:1114:18)
at afterConnectMultiple (node:net:1667:5)
at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
code: 'ECONNREFUSED',
[errors]: [ [Error], [Error] ]
}
} i get that error when i do npm run build, the app works fine when i run it with npm run dev but when i build it, i get that error12 Replies
Arboreal antOP
bump
Bighead carp
Are you doing any web requests in any of your pages
it might trying to statically render that page
@Bighead carp Are you doing any web requests in any of your pages
Arboreal antOP
yes i am
@Bighead carp it might trying to statically render that page
Arboreal antOP
how can i stop that?
Bighead carp
export const dynamic = 'force-dynamic';
Answer
@Bighead carp export const dynamic = 'force-dynamic';
Arboreal antOP
in what file do i put that?
Bighead carp
In the file you’re doing the fetch in
Specifically thenpage
Read the article and understand what it means
@Bighead carp In the file you’re doing the fetch in
Arboreal antOP
doesnt it automatically make it dynamic if data is fetched?