Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

308
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!