Is it possible to run firestore locally with cloud-functions?

Viewed 972

I am able to use firebase serve locally and use cloud functions with the real-time database. Is it possible to use cloud firestore locally?

1 Answers

local environment needs additional credential.

const serviceAccount = require("path/to/serviceAccountKey.json");
const isProd = process.env.NODE_ENV === 'production';

let firebaseOption = functions.config().firebase;
if (!isProd) {
  firebaseOption = { 
    ...firebaseOption,
    credential: admin.credential.cert(serviceAccount)
  };
}
admin.initializeApp(firebaseOption);

https://firebase.google.com/docs/admin/setup

Related