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

Run firebase emulators:start --only functions

Open alexpchin opened this issue 1 year ago • 5 comments

[REQUIRED] Environment info

13.3.1

firebase-tools:

macOs

Platform:

[REQUIRED] Test case

[REQUIRED] Steps to reproduce

When running firebase emulators:start --only functions I see: function ignored because the firestore emulator does not exist or is not running.

[REQUIRED] Expected behavior

I would expect to be able to run the emulated functions but connecting to a live firestore database.

[REQUIRED] Actual behavior

It seems like you can only run the functions emulator with the firebstore emulator?

alexpchin avatar Jun 17 '24 09:06 alexpchin

Hey @alexpchin, thanks for reaching out. Let me know if I may be wrong here, but from what I can tell, you’re trying to trigger local functions based on production events. If so, this is not possible. A detailed explanation can be found in https://github.com/firebase/firebase-tools/issues/1962#issuecomment-583498789.

However, if you’re trying to read/write data from/to production, you could use the Firebase Admin SDK.

aalej avatar Jun 17 '24 18:06 aalej

Hello @aalej Please can you re-open. I'm not trying to trigger local functions based on production events. I've got some firebase functions that are callable, http etc. What I want to be able to do is to call the functions from a localhost endpoint but for them to use the production firebase credentials.

This is part of a bigger task of trying to use the emulators within the context of a PR. I believe it should be possible to use the firebase functions locally, so that they are callable but they use a real firestore database in the config.

alexpchin avatar Jun 18 '24 07:06 alexpchin

I pretty much want to run as if I'm using:

firebase serve --only functions

alexpchin avatar Jun 18 '24 08:06 alexpchin

Thanks for the clarification @alexpchin. Just to verify, from what I understand you have Firebase Cloud Functions such as an HTTP function. When the function runs, you want to use the same credentials from production as credentials for the Firebase Admin SDK to write data to Cloud Firestore.

Is my understanding here correct, or am I missing anything? Would you be able to share a sample code snippet of your function?

aalej avatar Jun 18 '24 13:06 aalej

Hey @alexpchin - this message function ignored because the firestore emulator does not exist or is not running. will be shown when the Functions emulator skips over a Firestore triggered function. If you have HTTP or callable functions, they are still running.

joehan avatar Jun 18 '24 17:06 joehan

Hey @alexpchin. 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 09 '24 01:07 google-oss-bot

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

@alexpchin 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 12 '24 01:07 google-oss-bot