TypeError: Fetch Failed in Layout Server component
Unanswered
Atlantic menhaden posted this in #help-forum
Atlantic menhadenOP
Im working with:
I need to fetch data from different servers (no internal API routes) on my
This works locally but when building the app in gitlab my pipeline fail due to trying to
What are the best practices or strategies to handle such errors effectively? Are there any configurations or code patterns I should follow to make my build process more robust? Additionally, how can I properly fetch data at runtime in a Server Component to avoid these issues? Should I
nextjs 14.1.3
node 20I need to fetch data from different servers (no internal API routes) on my
Layout components to get information that will be used by my "Search Client component" that will live there to be share between all the modules.This works locally but when building the app in gitlab my pipeline fail due to trying to
fetch with the following stack trace snippet:Failed to fetch feature flag: TypeError: fetch failed
at Object.fetch (node:internal/deps/undici/undici:11372:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /app/apps/prdet/.next/server/chunks/343.js:80:43224
at async eg (/app/apps/prdet/.next/server/chunks/343.js:80:45165)
at async m (/app/apps/prdet/.next/server/chunks/671.js:2852:32)
at async O (/app/apps/prdet/.next/server/chunks/671.js:1:685753)
at async F (/app/apps/prdet/.next/server/chunks/671.js:1:685913) {
cause: Error: getaddrinfo ENOTFOUND strapi-hostname-cluster
at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:118:26)
at GetAddrInfoReqWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
errno: -3008,
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'strapi-hostname-cluster'
}What are the best practices or strategies to handle such errors effectively? Are there any configurations or code patterns I should follow to make my build process more robust? Additionally, how can I properly fetch data at runtime in a Server Component to avoid these issues? Should I
use export const dynamic = 'force-dynamic' ? wouldn't this be contra productive since nextjs is for server side ? same as using use-client1 Reply
Atlantic menhadenOP
up