Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emulator doesn't work with demo projects + web frameworks #6377

Closed
sqrrrl opened this issue Sep 19, 2023 · 6 comments · Fixed by #6674 or #6737
Closed

Emulator doesn't work with demo projects + web frameworks #6377

sqrrrl opened this issue Sep 19, 2023 · 6 comments · Fixed by #6674 or #6737

Comments

@sqrrrl
Copy link

sqrrrl commented Sep 19, 2023

[REQUIRED] Environment info

firebase-tools:
12.5.4

Platform:
ChromeOS/linux

[REQUIRED] Test case

  1. Setup with firebase init
  • Select firestore, hosting, functions
  • defaults for everything except hosting
    • Select use frameworks, vite, javascript
  1. Run firebase emulators:start --project demo-x

So far things work OK.

  1. Kill the emulator
  2. cd hosting
  3. npm i --save firebase
  4. cd ..
  5. run firebase emulators:start --project demo-x

Expected to run fine, but fails with error:

Error: could not find sites for project "demo-x"

[REQUIRED] Steps to reproduce

See above

[REQUIRED] Expected behavior

Adding firebase as a dependency to the web framework should still work with demo projects.

[REQUIRED] Actual behavior

fails with error:
Error: could not find sites for project "demo-x"

@sqrrrl
Copy link
Author

sqrrrl commented Sep 19, 2023

Appears to be here:

https://github.com/firebase/firebase-tools/blob/master/src/frameworks/index.ts#L207

Since everything that follows in that block seems optional (it's all skipped if no matching site) maybe just catch/log and continue?

@sqrrrl
Copy link
Author

sqrrrl commented Sep 25, 2023

Not sure if related, but also noticed that the default config is not correctly configuring functions to talk to the emulator. I'm curious if this is because it's trying to configure based on a live project where functions haven't been deployed yet? Or is that a separate issue?

@DevJoghurt
Copy link

DevJoghurt commented Oct 4, 2023

Found the same error. It can be solved by linking an active Firebase project.
Of course it would be nice if it would work in emulator mode without an active project and the prefix for projects 'demo-'.

@phcoliveira
Copy link

phcoliveira commented Nov 15, 2023

This seems to be a regression. I used to have a preview script in which I simply used NODE_ENV=production firebase emulators:start. With that command, Firebase Hosting was smart enough to determine that the application should be built, instead of served. From there, Firebase Hosting itselt hosted the application.
Now I have to use firebase emulators:exec --only=auth,database 'vite build && vite preview --port 5173' for a similar effect. The main difference now is that vite is serving the application, not Firebase Hosting.

@DevJoghurt
Copy link

I have tried the latest version (13.1.0) but still get the following error:

Error: could not find sites for project "demo-x"

@leoortizz leoortizz reopened this Feb 2, 2024
@leoortizz
Copy link
Member

My apologies, #6674 fixed an issue with Vite and emulators but not this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment