Failed to generate static paths for
Unanswered
Masai Lion posted this in #help-forum
Masai LionOP
I am running into the following error intermittently…
My
Any suggestions for what might be happening here?
- error Failed to generate static paths for /:
TypeError: fetch failed
at Object.fetch (node:internal/deps/undici/undici:11404:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async apiConnect (webpack-internal:///(rsc)/./app/lib/apiConnect.js:13:22)
at async dataPull (webpack-internal:///(rsc)/./app/layout.jsx:22:21)
at async eval (webpack-internal:///(rsc)/./app/layout.jsx:26:21) {
type: 'TypeError',
cause: {
name: 'ConnectTimeoutError',
code: 'UND_ERR_CONNECT_TIMEOUT',
message: 'Connect Timeout Error'
}
}My
apiConnect.js currently looks at such…export async function apiConnect(path, id, params = false) {
const KEYS = {
strapiAPI: process.env.STRAPI_APP_SITE_API,
strapiURL: process.env.STRAPI_APP_SITE_URL,
};
const headersList = {
Authorization: `Bearer ${KEYS.strapiAPI}`,
};
const response = await fetch(`${KEYS.strapiURL}/api/` + (path ? `${path}/` : '') + (id ? `${id}/` : '') + (params ? `?${params}` : ''), {
method: 'GET',
headers: headersList,
});
if (!response.ok) {
throw new Error(`API error: ${response.status} - ${await response.text()}`);
}
const data = await response.json();
return data;
}Any suggestions for what might be happening here?