DEV Community

Lumin
Lumin

Posted on

2 1

Fix Firebase error "auth/emulator-config-failed"

Official Document Said That

  • create app instance
  • create auth instance
  • then connect with emulator
const app = initializeApp(config.firebase)
const auth = getAuth(app)
connectAuthEmulator(auth, 'http://localhost:9099', { disableWarnings: true })
// note: 9099 is the default port Firebase used for their authen emulator
Enter fullscreen mode Exit fullscreen mode

But I got this when logged-in

Uncaught FirebaseError: Firebase: Error (auth/emulator-config-failed).
Enter fullscreen mode Exit fullscreen mode

Here's the Solution

From developer best friend Stackoverflow

async function setupEmulators(auth) {
  const authUrl = 'http://localhost:9099'
  await fetch(authUrl)
  connectAuthEmulator(auth, 'http://localhost:9099', { disableWarnings: true })
  // why? to make sure that emulator are loaded
}

const app = initializeApp(config.firebase)
const auth = getAuth(app)
setupEmulators(auth)
Enter fullscreen mode Exit fullscreen mode

Happy

Speedy emails, satisfied customers

Postmark Image

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (1)

Collapse
 
palexandrite profile image
Alexander Bulatov

Thanks a lot!

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs