firebase-tools icon indicating copy to clipboard operation
firebase-tools copied to clipboard

Unable to switch emulators local url after changing project

Open Cruzor-Blade opened this issue 5 months ago • 1 comments

[REQUIRED] Environment info

firebase-tools: 14.7.0

Platform: Windows

[REQUIRED] Test case

Initialize a firebase project, with functions and the functions emulator enabled. Start the emulator. Local url is correct here. Shut the emulator down, change use another firebase project, then relaunch the emulator. Functions will still be using the id of the previous project.

Note: I am using single project mode, and have checked the .firebaserc file and the id is correctly set to the new project.

[REQUIRED] Steps to reproduce

I am unable to switch the local url of the functions emulator. The firebase project folder was previously pointing to another firebase project, and has been changed. But when launching the emulator, the functions still use the previous project Id in the url

[REQUIRED] Expected behavior

http://127.0.0.1:5001/new-project-id/location-name/functionName

[REQUIRED] Actual behavior

http://127.0.0.1:5001/old-project-id/location-name/functionName

Cruzor-Blade avatar Jun 18 '25 18:06 Cruzor-Blade

Hey @Cruzor-Blade, I'm trying to reproduce the behavior you mentioned but so far haven't encountered the issue. The url for the functions are using the correctly set project ID.

Just to verify, are the steps to reproduce the issue:

  1. Run firebase init functions --project OLD_PROJECT_ID
    • Uncomment the default https function code
  2. Run firebase init emulators
  3. Run firebase emulators:start
    • Function url is http://127.0.0.1:5001/OLD_PROJECT_ID/us-central1/helloWorld
  4. Shut down the emulators
  5. Run firebase use --add NEW_PROJECT_ID --alias staging
  6. Run firebase emulators:start
    • Functions url is http://127.0.0.1:5001/NEW_PROJECT_ID/us-central1/helloWorld

Let me know in case I'm missing a step here, or if I misunderstood the issue.

The firebase project folder was previously pointing to another firebase project, and has been changed

Try running firebase use to get a list of project IDs and aliases you have in your working directory. If you see the project ID you want to use, run firebase use PROJECT_ID or firebase use ALIAS to switch to that project.

aalej avatar Jun 19 '25 10:06 aalej

Hey @Cruzor-Blade. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot avatar Jun 30 '25 01:06 google-oss-bot

Hey @Cruzor-Blade - we actually track what project is active in Configstore. Can you check ~/.config/configstore/firebase-tools.json? The 'activeProjects' field of that file will have a mapping of directories to active projects - I suspect that your current directory is still pointing to the old project there.

joehan avatar Jul 01 '25 17:07 joehan

Hey @Cruzor-Blade. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot avatar Jul 10 '25 01:07 google-oss-bot

Since there haven't been any recent updates here, I am going to close this issue.

@Cruzor-Blade if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

google-oss-bot avatar Jul 15 '25 01:07 google-oss-bot