Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

317
Visualizações
NextJS project not generating static pages on build. Fails with timeout error

I am working on NextJS project with TypeScript. For some strange reasons it is failing to compile either for development or production. It fails with timeout error as shown in the following error trace

> Build error occurred
Error: Static page generation for /posts/introducing-hapana-v1 is still timing out after 3 attempts. See more info here https://nextjs.org/docs/messages/static-page-generation-timeout
    at onRestart (/app/node_modules/next/dist/build/index.js:487:31)
    at Worker.exportPage (/app/node_modules/next/dist/lib/worker.js:49:40)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async /app/node_modules/next/dist/export/index.js:412:32
    at async Span.traceAsyncFn (/app/node_modules/next/dist/trace/trace.js:74:20)
    at async Promise.all (index 3)
    at async /app/node_modules/next/dist/export/index.js:407:9
    at async Span.traceAsyncFn (/app/node_modules/next/dist/trace/trace.js:74:20)
    at async /app/node_modules/next/dist/build/index.js:987:17

This following is the dynamic page [slug].tsx

const PostDetailsPage: React.FC<PostDetailsProps> = (props) => {
  // console.log(post);

  const { post, posts } = props;

  if (!post || !posts) return <Loader />;

  return <Post post={post} posts={posts} />;
};

export async function getStaticProps(context: any) {
  const slug = context.params.slug;

  const { data: postData } = await getPost(slug);
  const { data: posts }: DataInterface = await getBlogPosts(1);
  return {
    props: {
      post: postData,
      posts: posts.results,
    },
  };
}

export async function getStaticPaths() {
  const { data: posts }: DataInterface = await getBlogPosts(1);
  const slugs = posts.results.map((p) => ({ params: { slug: p.slug } }));
  return {
    paths: slugs,
    fallback: true,
  };
}

export default PostDetailsPage;
export const getBlogPosts = (page: number) => {
  return http.get(apiEndpoint + `posts/?cats=blog&page=${page}`);
};
export const getPost = (postSlug: string) => {
  return http.get(postUrl("posts/" + postSlug + "/"));
};

Please note http is just an axios interceptor function Could anyone help me resolve this issue?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda