I am developing a project with Firebase backend, utilising Firebase Functions. I actually two projects: myProject
and myProject-test
(used for deployment testing).
When submitting API calls, my (React) front-end is configured to call the myProject-test
URL when running in local development, and only direct the calls to myProject
when deployed on PROD.
The problem I am facing is that when I start my cloud functions emulator using firebase emulators:start
, my cloud functions get started on the localhost:5001/myProject/...
url instead of localhost:5001/myProject-test/...
, and hence the API calls from my local development instance never arrive.
How can I control for which project the emulators start?
CodePudding user response:
This is what the firebase use
command is for. Read the documentation on managing aliases. You can run the command firebase use PROJECT_ID|ALIAS
to set the current project or alias that is currently use use for the emulator or other commands.