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

Why can't we use the CLI as a module in Cloud Functions? #1462

Closed
ollietreend opened this issue Jul 3, 2019 · 2 comments · Fixed by #1464
Closed

Why can't we use the CLI as a module in Cloud Functions? #1462

ollietreend opened this issue Jul 3, 2019 · 2 comments · Fixed by #1464
Assignees
Labels

Comments

@ollietreend
Copy link

The project README states:

The Firebase CLI can also be used programmatically as a standard Node module. This can only be done on your machine, and cannot be done within Cloud Functions.

My question is – why can't it be used as a standard Node module from within a Cloud Function?

An example where this would be useful:

To be able to execute the auth:export command from within a scheduled Cloud Function to take a regular backup of the user authentication database.

@samtstern
Copy link
Contributor

@ollietreend you definitely can use the CLI as a module inside a Cloud Function, that warning is a little harsh. The reason for that warning is that sometimes the CLI requires access to a file system and that will not work reliably on a Cloud Function.

Here's a guide about deleting data from Firestore where we use the CLI as a module in a Cloud Function:
https://firebase.google.com/docs/firestore/solutions/delete-collections

@ollietreend
Copy link
Author

Got it. Thanks for clarifying, @samtstern! 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants