Google is committed to advancing racial equity for Black communities. See how.

Connect your app to the Cloud Functions Emulator

Before connecting your app to the Cloud Functions emulator, make sure that you understand the overall Firebase Local Emulator Suite workflow and that you install and configure the Local Emulator Suite.

Instrument your app to talk to the emulators

Instrument your app for callable functions

If your prototype and test activities involve callable backend functions, configure interaction with the Cloud Functions for Firebase emulator like this:

        // is the special IP address to connect to the 'localhost' of
        // the host computer from an Android emulator.
        FirebaseFunctions functions = FirebaseFunctions.getInstance();
        functions.useEmulator("", 5001);
iOS - Swift
Functions.functions().useFunctionsEmulator(origin: "http://localhost:5001")

Web v8

firebase.functions().useEmulator("localhost", 5001);

Web v9

import { getApp } from "firebase/app";
import { getFunctions, useFunctionsEmulator } from "firebase/functions";

const functions = getFunctions(getApp());
useFunctionsEmulator(functions, "localhost", 5001);

Instrument your app for HTTPS functions emulation

Each HTTPS function in your code will be served from the local emulator using the following URL format:


For example a simple helloWorld function with the default host port and region would be served at:


Instrument your app for background-triggered functions emulation

The Cloud Functions emulator supports background-triggered functions from the following sources:

  • Realtime Database emulator
  • Cloud Firestore emulator
  • Authentication emulator
  • Pub/Sub emulator

To trigger background events, connect your app or test code to the emulators using the SDK for your platform.

What next?