I'm trying to call a Firebase Cloud Function from my React Native Expo app to send invoice emails. The function deploys successfully, but when I call it from the app, I get a FirebaseError: not-found error. Cloud Function (functions/index.js):
const functions = require('firebase-functions');
const express = require('express');
const nodemailer = require('nodemailer');
const sendInvoiceToXeroApp = express();
sendInvoiceToXeroApp.use(express.json());
sendInvoiceToXeroApp.post('/', async (req, res) => {
res.set('Access-Control-Allow-Origin', '*');
res.set('Access-Control-Allow-Methods', 'POST, OPTIONS');
res.set('Access-Control-Allow-Headers', 'Content-Type');
if (req.method === 'OPTIONS') {
res.status(204).send('');
return;
}
const { invoiceData, signatureBase64, testEmail } = req.body;
// Email sending logic here...
res.status(200).json({ success: true });
});
exports.sendInvoiceToXero = functions.https.onRequest(sendInvoiceToXeroApp);
React Native Component:
import { getFunctions, httpsCallable } from 'firebase/functions';
const submitInvoice = async () => {
try {
const functions = getFunctions();
const sendInvoice = httpsCallable(functions, 'sendInvoiceToXero');
const result = await sendInvoice({
invoiceData,
signatureBase64: signature,
testEmail: '[email protected]'
});
console.log('Success:', result.data);
} catch (error) {
console.error('Error submitting invoice:', error);
// ERROR: [FirebaseError: not-found]
}
};
What I've tried:
Deployed the function successfully with firebase deploy --only functions:sendInvoiceToXero Function shows as deployed in Firebase Console Verified Firebase config in app matches project Checked Firebase Functions region (using default us-central1)
The Error is this
ERROR Error submitting invoice: [FirebaseError: not-found]
Questions:
Why would the function be deployed but return "not-found" when called from the app? Do I need to configure something specific for Express-based Cloud Functions? Could this be a region mismatch issue between the app and function?
Firebase SDK versions:
firebase: 10.x @react-native-firebase/app: 21.x firebase-functions: 6.x (in Cloud Functions)
Any help would be appreciated!