Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

328
Vistas
Slow initial load for API data

Issue:

  • NextJS app takes ~20s to load page with getServerSideProps or getStaticProps
  • After the initial load, everything works fine
  • Issue repeats after site is inactive for about 10min or more
  • This issue does not happen when I npm run build then npm run start from my local machine but does on live site and npm run dev
  • API is currently hosted with Strapi on Heroku (free tier)
  • Exact same thing happens on another site with data hosted on MongoDB (M10 Tier)

Code for page:

const Index = ({ properties, total }) => {
  return (
    <Container>
      <DashboardDrawer />
      <Search />
      <PropertyList properties={properties} />
      <Pagination page={1} total={total} />
    </Container>
  );
};

export default Index;

export const getServerSideProps = async ({ query: { page = 1 } }) => {
  // Calculate start page
  const start = +page === 1 ? 0 : (+page - 1) * PER_PAGE;

  // Fetch total/count
  const totalRes = await fetch(`${API_URL}/properties/count`);
  const total = await totalRes.json();

  // Fetch properties
  const propertyRes = await fetch(
    `${API_URL}/properties?_limit=${PER_PAGE}&_start=${start}`
  );
  const properties = await propertyRes.json();

  return {
    props: { properties, page: +page, total },
  };
};
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda