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

309
Views
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 answers
Answer question

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 Report
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!