firebase-tools: 7.12.1
Platform: macOS
firebase emulators:start --only functions within ProjectName/functions/{
"functions": {
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint"
],
"source": "functions"
},
"emulators": {
"functions": {
"port": 5001
}
}
}
To firebase.json
app.functions().useFunctionsEmulator('http://localhost:5001'); after initializing firebase app (e.g. const app = firebase.initializeApp(config);)
The app calls the function and the functions returns the expected response with no Internal server error.
[Error: Internal] after making the call to the cloud function. Logs do not output anything. console logging on the first line of the cloud function doesn't output anything, so it doesn't even get inside the function.
However, if I paste the url generated from the emulator into my browser, the emulator does output logs, which tells me that there's something wrong with how the app is calling the function.
@lucasgismondi a few questions:
1) Where does [Error: Internal] show up ... in your iOS app logs?
2) Can you run firebase --debug emulators:start --only functions (notice the --debug flag) and show us the logs from the emulators when the function appears not to be called? There may actually be something going on.
Thank you for prompt reply!
Yes but in my react-native logs. This is my app logs after calling the function. (I'm console logging the error returned from the catch block)

Nothing is being printing in the functions emulator logs using the --debug flag. Here's a screenshot

Same issue here. Any updates on this?
@lucasgismondi sorry but this really is not enough information to figure out what's going wrong here. It seems like the request is never getting from your React Native app to the functions emulator but I don't know at what point it's failing. Error: internal could be coming from any part of the stack.
Are you using RNFirebase? If so I would suggest filing an issue on their repo to see if they can help you trace where the request is failing.
@samtstern @JoshLiquornik I found the issue. Since I'm attempting to call the emulated functions on a mobile device, I had to run firebase serve --only functions -o 0.0.0.0 then use app.functions().useFunctionsEmulator('http://<local ip>:<port>');
I just forgot that you can't call localhost functions from other devices....
Thanks for following up! I've made that same mistake many times.
Most helpful comment
@samtstern @JoshLiquornik I found the issue. Since I'm attempting to call the emulated functions on a mobile device, I had to run
firebase serve --only functions -o 0.0.0.0then useapp.functions().useFunctionsEmulator('http://<local ip>:<port>');I just forgot that you can't call localhost functions from other devices....