Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

651
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!