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

221
Visualizações
Nextjs deployment fails with firebase backend (getStaticProps and getStaticPaths)

I am trying to deploy my nextjs website in vercel. I am using firebase as the backend. I have a dynamic route and I am using getStaticProps and getStaticPaths to get the data and populate it.

The build always succeeds in the local environment but fails in vercel. I am attaching the build error screenshot (Though it warns but the build fails) and minimal code.

export const getStaticPaths: GetStaticPaths = async () => {
  try {
    const builderCollection = collection(db, 'something')
    const builderSnapshot = await getDocs(builderCollection)
    const refs = []
    builderSnapshot.forEach((doc) => {
      const data = doc.data()
      if (data && data.ref) {
        console.log('Store: Firebase path data', data.ref)
        refs.push(data.ref)
      }
    })
    const paths = refs.map((ref: string) => {
      return {
        params: {
          ref,
        },
      }
    })
    return { paths, fallback: 'blocking' }
  } catch (error) {
    console.log(error)
    return { paths: [], fallback: 'blocking' }
  }
}

export const getStaticProps: GetStaticProps = async (context) => {
  try {
    const { ref } = context.params
    console.log('Store Ref:', ref)

    const builderCollection = collection(db, 'builder')
    const checkQuery = query(builderCollection, where('ref', '==', ref))
    const checkerSnapshot = await getDocs(checkQuery)
    let fbData: DocumentData | null = null
    let id: string
    checkerSnapshot.forEach((doc) => {
      if (doc.exists()) {
        id = doc.id
        fbData = doc.data()
      }
    })
    return {
      props: { data: fbData, id },
      revalidate: 1,
    }
  } catch (error) {
    console.log(error)
    return { props: { data: null } }
  }
}

I am unable to debug this error. I have tried increasing the staticPageGenerationTimeout up to 2000sec. But still fails. Highly appreciated it if someone could help me. Thanks in advance.

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