Where can I find documentation about firebase-tools.firestore.delete? - firebase

In the guide for Firestore on deleting a whole collection, there is an example using firebase_tools.firestore.delete. Where can I find documentation about this function? I only found it mentioned in the CLI reference but with little detail.

In most cases the firebase-tools library is only used in the CLI to Firebase projects. So the documentation for that command is in the reference docs for the CLI, but its admittedly a bit lightweight for the Firestore delete command.
Luckily the firebase-tools library is open-source, so you can check exactly what it does by looking at the code. The firestore:delete command is implemented here and here.
If you run into specific problems while implementing similar functionality, or have specific questions about it, I recommend posting those specific problems/questions. For example: the command indeed deletes subcollections.

Related

How to find migration guide for firebase-functions v4

The console informed me yesterday that I should update firebase-functions to v4, we've been on v3.21.2. It also informed me that there would be breaking changes.
All I can find it this: https://github.com/firebase/firebase-functions/releases/tag/v4.0.0, but it'd be great to find a real migration guide? For now I guess I'll search functions wide for the things that are included in that changelog.
Firebaser here. There are more detailed release notes in the docs, but no migration guide, sorry! The most important things to do when migrating to firebase-functions 4.0.0 are:
Use Node 14 or 16 (preferably 16)
Update the firebase-functions, firebase-admin, and firebase-functions-test libraries:
npm install --save firebase-functions#latest firebase-admin#latest firebase-functions-test#latest
There are a couple of changes for specific triggers:
If you're using callable functions & App Check, switch any use of allowInvalidAppCheckToken to enforceAppCheck
If you're using Realtime Database triggers, the DataSnapshot in the event payload will look a little different, but hopefully in a good way - it will now match the DataSnapshot returned by the Admin SDK
Besides that, it's mostly improvements, like better logging, better Typescript types, and new triggers (Remote Config and Test Lab for 2nd-gen functions), as well as a new way to parameterize functions with the params subpackage. It's always recommended to test functions locally with the emulator suite, firebase-functions-test, or functions:shell to catch errors before deploying to production.

How to use aria2c on cloud function?

In the same way that a cloud function can run the ffmpeg, is possible download and run aria2c? If yes, how?
PS. Cloud Run isn't an option right now.
Edit: Something like this https://blog.qbatch.com/aws-lambda-custom-binaries-support-available-for-rescue-239aab820d60
Executing custom binaries like aria2c in the runtime are not supported in Cloud Functions.
You can find a hacky solution here: Can you call out to FFMPEG in a Firebase Cloud Function This involves having a statically linked binary (so you might need to recompile aria2c as I'm assuming it won't be statically linked by default and it'll rely on more system packages like libc, libxxxx...) and bundling this library to your function deployment fackage.
You should really consider using Cloud Run for this use case. Cloud Run gives you the flexibility of creating your own container image that can include the binaries and libraries you want.
You can find a tutorial that bundles custom binaries on Cloud Run here: https://cloud.google.com/run/docs/tutorials/system-packages

Google Cloud / Firebase Functions, handling dependencies per function

We have a couple of functions that require a lot of dependencies to work. We have so called jar/npm/lib hell going on, and would like to limit the dependencies on function, rather than on project level. Is this possible?
Edit: trying to rephrase the question as Doug instructed: We're using Firebase functions and we'd like to isolate the function's dependencies from other function's dependencies. We need version x.y.z of dependency A for function 1 to work, but function 2 needs version f.y.z of the same dependency A to work.
I suspect that the only way around this is to deploy it to another project, but wanted to ask a question here before committing to that.
So, can we have multiple versions of the same dependency in one Firebase Functions deployment?
Edit 2: Divided the other part of the question here: Firebase Functions: is it OK to divide functions to multiple projects
The answer is no, one can't control the dependencies per function, but per deployment. This is more of a limitation of npm itself than Firebase / Google Cloud Functions.

How does one turn on diagnostic and/or progress logging with firebase-tools run as a node module?

I have not been able to find any reference for the options passed into the node module version of firebase-tools. How do one turn on diagnostic logging or progress output? The github README for firebase tools only says:
The Firebase CLI can also be used programmatically as a standard Node module. Each command is exposed as a function that takes an options object and returns a Promise.
and has only the example:
client.deploy({
project: 'myfirebase',
token: process.env.FIREBASE_TOKEN,
cwd: '/path/to/project/folder'
}).then(function() {...
It would be really nice to get complete docs. The source code wasn't much help.
There isn't a good way to see progress via the programmatic API for the Firebase CLI right now. Your best bet would be to instead use spawn or similar to run it as a process and simply capture the stdout.
We'd like to improve this in the future but there are no concrete plans of what it will look like yet.
To see the complete list of keys off of the client object, see commands/index.js
In terms of what options to pass in, that is definitely hard to figure out. This seems like a great chance to submit an issue requesting specific improvements to documentation, or take a shot at documenting it yourself and submit a PR.

getting started with flyway for one with no java experience

I am interested in testing flyway and if I am not wrong I read that it supports db changes both through java and SQL. I am a dba and familiar with SQL but not java.
I read through the “Getting Started” page and wanted to try out the sample application available under the “Downloads tab” link however I couldn’t find any readme document explaining the available downloads which appeared to contain .jar files.
Q) is there an instruction manual for a newbies to explain how to put together this sample application?
Q) can one uses flyway without knowing java? If yes, please provide any how-to url/notes/documents available. If not do you have any how-to for one to get started with java just enough to operate this tool?
Thanks Bob
I think you might find the command line tool useful:
http://flywaydb.org/documentation/commandline/
As it says on the website:
The Flyway command-line tool is meant for users who
do not run their applications on the JVM
wish to migration their database from the command-line without having to install Maven
You may need to browse the source code to figure out some more details:
https://github.com/flyway/flyway
Although I think you should be able to adapt the regular documentation to the CLI option.
Try starting here:
http://flywaydb.org/getstarted/existingDatabaseSetup.html

Resources