I can see this list of directories in the browser. Here I can create new dirs or delete it.
But how can I download it?
Can I move all incoming data to our paid Google Cloud Platform Bucket?
And this is about paid bucket. We have this view:
When you use Storage in Firebase, you're actually just using a Google Cloud Storage bucket. The easiest way to work with the contents of a Cloud Storage bucket is with the gsutil comment line. When you have that installed and configured, then you can run commands to copy the contents of the bucket to and from your local machine, with gsutil cp, for example:
gsutil cp -r gs://deeplabandroid.appspot.com/Values .
Related
I have installed Firebase extension Delete User Data which triggers of user deletion. I have mentioned the storage paths as per the provided instructions.
Where in Google Cloud Storage do you store user data? Leave empty if
you don’t use Cloud Storage. Enter the full paths to files or
directories in your Storage buckets, separated by commas. Use {UID} to
represent the User ID of the deleted user, and use {DEFAULT} to
represent your default Storage bucket. Here’s a series of examples. To
delete all the files in your default bucket with the file naming
scheme {UID}-pic.png, enter {DEFAULT}/{UID}-pic.png. To also delete
all the files in another bucket called my-app-logs with the file
naming scheme {UID}-logs.txt, enter
{DEFAULT}/{UID}-pic.png,my-app-logs/{UID}-logs.txt. To also delete a
User ID-labeled directory and all its files (like media/{UID}), enter
{DEFAULT}/{UID}-pic.png,my-app-logs/{UID}-logs.txt,{DEFAULT}/media/{UID}
Cloud Storage Paths: {DEFAULT}/profilepic/{UID}.jpeg
I am always getting the following log
File: 'profilepic/uid_1234.jpeg' does not exist in Cloud Storage, skipping
It has been report in the github issues for firebase extension. For Extension version: 0.1.7 check the temporary fix by using your storage bucket name instead of DEFAULT.
To find your bucket name:
Go to your Storage dashboard in the Firebase console.
Click the Files tab, then look in the header of the file viewer.
Copy the URL to your clipboard. It's usually in the form project-id.appspot.com.
Instead of
{DEFAULT}/profilePhotos/{UID}.jpg
use:
your-project.appspot.com/profilePhotos/{UID}.jpg
where your-project.appspot.com is your bucket name.
I am not sure the latest extension 0.1.8 fixed the issue
Source
I do not have billing associated with my google account but when I create a new firebase project I can create a default bucket just by going to storage section on console and pressing get start (check the screenshot)
but when I try to create this default gsutil
gsutil mb -p project-id gs://project-id.appspot.com/
I got this error
AccessDeniedException: 403 The project to be billed is associated with an absent billing account.
is there any way to enable this default storage using gsuitl, code or command without opening the console site?
Firebase's default bucket works basically by building the storage costs into your Firebase bill. But gsutil is a GCS tool, i.e., you're attempting to use the underlying storage that Firebase uses. To do that, you need to set up billing first.
Looks like it is billing issue, first setup billing then try to create bucket.
you can use gsutil or use GCP UI to create bucket
We've recently created a GCP project and a Cloud Storage bucket in it.
Then we decided to use Firebase to host our React app. However, after creating the Firebase project (Why did we need to create a new project?), we got a different storage bucket. And it seems that it's not possible to view the same bucket from both projects.
Our backend uses a Cloud Storage bucket. Our frontend sends files to a Firestore bucket, which is different. How can we link it together?
It's important to know that a Firebase project IS a Google Cloud project. Read more about that in this blog. Firebase is essentially a layer of APIs and services in a Google Cloud project. What you probably should have done in the first place is add Firebase to your existing Cloud project, but it's probably not worthwhile to do that if you already have an existing Firebase project.
There's really no way to link the projects together that would be convenient for you. What I recommend you do is abandon your first Cloud project, and copy the contents of your first bucket into your Firebase project default bucket. Also read more about the relationship between Firebase and Google Cloud with respect to Cloud Storage in this blog.
You can use Firebase storage's getStorage function to specify the Google Cloud Storage Bucket. Then use gsutil to add the appropriate permissions between your Firebase project and the GCS bucket. You may need to edit the bucket permissions by going to Storage > Buckets and selecting Edit Bucket Permissions from the kebab menu (⋮) right of the bucket name. Here, you add can add the service-#gcp-sa-firebasestorage.iam.gserviceaccount.com
Frontend/browser Firebase code:
import { getApp } from "firebase/app";
import { getStorage } from "firebase/storage";
const firebaseApp = getApp();
const storage = getStorage(firebaseApp, "gs://my-custom-bucket");
command line to add permissions:
gsutil -m acl ch -r -u service-<project number>#gcp-sa-firebasestorage.iam.gserviceaccount.com gs://<my-custom-bucket>
The service-project number can be found in the Firebase project's console, under settings.
I have an application on firebase, but I must have server backup on another server, in cloud hosting or VPS, Please help me
Both Firebase Realtime Database and Firestore offer backup capability to a GCS bucket.
Firebase Realtime Database:
Use the "Backups" tab on the console and use the wizard to configure the backup. There's more about how to restore and how files are named here. There is no additional cost for the backup operation, but you are obviously charged for the storage of the backups in GCS.
For Firestore:
You can use the gcloud firestore export gs://[BUCKET_NAME] command to export to a GCS bucket, either the entire database or just one collection. Full documentation about restores, partial exports, etc, is here. Note you are charged for document reads to do the backup in addition to the GCS storage costs.
There does not appear to be a built-in way to automate this but the Admin SDK includes a FirestoreAdminClient.exportDocuments (that link is for Node) call you could presumably use to call from a scheduled cloud function to do the work.
You must be on the Blaze (pay as you go) plan for both databases.
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.