Skip to content

Instantly share code, notes, and snippets.



Created May 15, 2020
What would you like to do?
Use Firebase Cloud Functions to call a method from both callable and http requests
function callMeAnywhere(uid, foo) {
if( !uid ) throw new Error("Must authenticate");
return foo + 'bar';
functions.https.onCall((data, context) => {
const data = callMeAnywhere(context.auth.uid,;
return {data: data};
// Use this with
app.get('/foo', (req, res) => {
const data = callMeAnywhere(,;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment