Reputation: 373
I'm trying to test my firebase functions in my React Native Expo app. Here's my initialization code:
import { connectFunctionsEmulator, getFunctions } from 'firebase/functions'
// ...Initialize app
export const fucntions = getFunctions()
connectFunctionsEmulator(fucntions, "localhost", 5001)
I then have code which maps functions in an object:
import { httpsCallable } from "firebase/functions";
import { fucntions } from "../../firebase";
export default {
helloFirebase: httpsCallable(fucntions, "helloFirebase")
}
And I call the function as follows:
functionsObj.helloFirebase({ myParam: "Hello!" })
.then((res) => {
console.log(res)
})
.catch((error) => {
console.log(error.message)
})
But when I call the function I get the following, very small and unspecific error message in the console:
ERROR: internal
I'm guessing it's something to do with not being able to access localhost, but I still don't know how to fix the issue.
Any help would be appreciated, thanks!
Upvotes: 0
Views: 291
Reputation: 373
FIXED: I found this article on this exact issue.
Make sure to run firebase serve --only functions -o ${YOUR_LOCAL_IP}
once you've followed all the steps
Upvotes: 1