I need to upload files to Firebase Cloud Storage with REST api; I read that Firebase doesn't provide them but Google Cloud Storage does. I need that a firebase cloud function will be triggered on uploads. I know that Firebase is backed by GCS, so I'll use it, but I didn't find if upload on GCS will trigger a Firebase Cloud function too. Does anybody know anything?
Since nobody answered me, I tried and the result is: yes, Firebase function is triggered even if I use GCS rest api to upload on bucket.
Related
I deployed a cloud function in firebase but instead of using a local emulator for testing purposes, I redeployed it several times to debug and test. After this, I see that my usage in the cloud storage in firebase is upwards of 500 MB although I have not stored any files in the Cloud Storage. Is this due to the multiple redeployments of the function? If yes, will deleting the cloud function free up this space or is there another way.
Thanks.
Yes, deploying a Cloud Function will take up more space in Cloud Storage. There is a dedicated storage bucket for the build of the server images that get deployed. You can see this for yourself in the Google Cloud Console for your project. You can manually delete the content if you don't want to pay for the storage.
I don't think that deleting the function will also delete the storage, but you can try that for yourself and observe if it works the way you expect.
See also:
How to delete outdated Firebase Cloud function containers from GC Storage?
will Cloud Function affect Firebase Storage bandwidth usage?
I just started doing firebase and I need to do something when a new document is created but in functions and I setup cli and started locally but the function is not triggered.
while doing firebase init I chose firestore,functions,storage
after that did firebase login and firebase serve --only functions
and the server is up but whenever I add new document the function is not getting triggered?
You should be able to do that with firebase emulators:start. This starts emulators for Cloud Functions, Cloud Firestore, Realtime Database and Firebase Hosting. If that doesn't work, please share your code and I can have a look.
The docs may be useful too: https://firebase.google.com/docs/functions/local-emulator#run_the_emulator_suite
Is it possible to setup a Firebase cloud function that serves a file from a Firebase cloud storage bucket to avoid using the long firebasestorage.googleapis.com link
Yes, that is possible. In that case you can even go without download URLs, since in Cloud Functions you'll have administrative access to all files in your Cloud Storage bucket anyway.
I have a backend in golang and was wondering how I can connect to Firebase storage to create/delete buckets and add/delete files. Can I use the Admin sdk. I found the client storage lib in golang for google cloud storage. Can I use that? And whats the difference between firebase storage and google cloud storage?
The app I'm working on connects to Firebase Storage Buckets via the Admin SDK, but we're using Firebase Functions in Node.js. However, it looks like the Admin SDK in Go offers the same Storage access, and it's documented (with example code in Go) here:
https://firebase.google.com/docs/storage/admin/start
I like using Admin in Firebase, because you don't have to worry about project configuration and authentication to the various services. Firebase storage is google cloud storage, but with a nice wrapper and well-integrated into other aspects of your Firebase project. You get some limitations as a trade-off for all of that convenience, but unless you run into a feature of Google Cloud that you absolutely need and doesn't exist in Firebase, I'd stick with the Firebase (and Admin) version.
As I know currently Cloud Functions doesn't support triggering functions from Firebase.
For now I'm planing to use an basic Engine instance to trigger the functions based on the queue.
Is this the right way to go? or should I trigger the cloud function directly from the clients device after the data is inserted in the db?
thank you
Cloud Functions for Firebase was just launched today! You can use the SDK to trigger cloud functions from your Firebase database, storage bucket, authentication, and analytics events. https://firebase.google.com/docs/functions/