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

105
Visualizações
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 à 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