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

657
Visualizações
next.js Firebase Error (auth/operation-not-supported-in-this-environment)

I have deployed a vercel hosted next app with firebase authentication that works for users. But mysteriously during the "npm run build" phase this error pops up:

FirebaseError: Firebase: Error (auth/operation-not-supported-in-this-environment).

and

code: 'auth/operation-not-supported-in-this-environment', customData: {}


  const provider = new GoogleAuthProvider()
  const auth = getAuth()

  const handleLogin = () => {
    signInWithRedirect(auth, provider)
      .then((result) => {
        console.log('with redirect: ' + result)
      })
      .catch((error) => {
        // Handle Errors here.
        console.log(error)
      })
  }
  getRedirectResult(auth)
    .then((result) => {
      // This gives you a Google Access Token. You can use it to access Google APIs.
      const credential = GoogleAuthProvider.credentialFromResult(result)
      const token = credential.accessToken

      // The signed-in user info.
      const user = result.user
      console.log(user)

    })
    .catch((error) => {
      // Handle Errors here.
      console.log(error)
      // ...
    })

This is the meat of the authentication code. I stuck as closely as I could to the firebase docs.

Is there a reason related to next.js or the "Authorized Domains" firebase requires that this build/deployment error is being caused?

Thank you for your consideration.

Bonus Info Versions:

Firebase: 9.8.4 Next Js: 12.1.5

This is how I'm initializing the firebase app.

const initMyFirebase = () => {
  if (!getApps().length) {
    const app = initializeApp(firebaseConfig)

    // creating auth for authentication
    const auth = getAuth(app)
const theme = extendTheme({ colors })

function MyApp({ Component, pageProps }) {
  initMyFirebase()
  return (
    <ChakraProvider theme={theme}>
      {/*// <ChakraProvider>*/}
      <Component {...pageProps} />
    </ChakraProvider>
  )
}
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