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

103
Vistas
GetStaticProps Revalidate is not working as expected

Problem: Revalidate doesn't work when im useing (serverSideTranslations) from next-i18next. Please see my code below.

When a new user register, an static page is generated for each language: (da (Default), en, sv, de). Everyting works fine with the code below, for allready generated pages at build time (When deployed on Vercel).

When a new user register, the page wont get revalidated and thorws a 500 Internal server error. / The page was not generated

Please see comment in code!

export async function getStaticPaths({ locales }) {
  const { data: profiles, error } = await supabase.from("profiles").select("*");
  console.log(locales);

  const paths = profiles
    .map((profile) =>
      locales.map((locale) => ({
        params: { profileName: profile.username },
        locale, // Pass locale here
      }))
    )
    .flat();

  console.log(paths);
  return { paths, fallback: "blocking" };
}

export async function getStaticProps({ params, locale }) {
  const { data: profiles, error } = await supabase
    .from("profiles")
    .select("*")
    .eq("username", params.profileName)
    .single();

  return {
    props: {
      profiles,
      ...(await serverSideTranslations(locale, ["Profil"])), //When this line is removed everything works fine  --- When its added GetStaticPaths and GetStaticProps breaks.
    },
    revalidate: 30,
  };
}

about 4 years ago · Santiago Gelvez
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