Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

311
Vistas
Instruct locally emulated firebase function to use authentication emulator

I am using firebase emulator suite to test my app. I have set up emulators for hosting, authentication, firebase and functions.

When I try to create a user from front-end using firebase.auth().createUserWithEmailAndPassword() it works fine.

All other emulators work as expected too..

I am able to call a callable function from my front-end:

in public/app.js

const createUser = functions.httpsCallable('createUser');
createUser({
    username: username,
    email: email,
    password: password,
})

in functions/index.js

const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();

exports.createUser = functions.https.onCall((data, context) => {
    // creates a new user
    return admin.auth().createUser({
        email: data.email,
        emailVerified: false,
        password: data.password,
        displayName: data.username,
        disabled: false
    });
});

This function gets called, however it does not create a user on the auth emulator, but in production.

I want my user to be created on the auth emulator, so that it can trigger auth functions in my functions/index.js

For example:

exports.userCreated = functions.auth.user().onCreate(user => {
    // creates a firestore document in users collection
    return admin.firestore().collection('users').doc(user.uid).set({
        email: user.displayName
    });
});

There does not seem to be anything about connecting Node.js Firebase SDK to the auth emulator (admin.auth().useEmulator() is not defined).

How do I go about instructing a Node Admin SDK to use local auth emulator?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

I followed @Vazgen answer, and I can confirm that update the firebase-admin to the latest version can fix it, version 9.9.0 as of this writing.

npm install firebase-admin@latest
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda