Firebase Storage on nodejs

2,975 views
Skip to first unread message

Muhammad Kamran Qadri

unread,
Jun 21, 2016, 10:20:31 AM6/21/16
to Firebase Google Group
I am unable to find firebase storage on firebase library of nodejs.

Jacob Wenger

unread,
Jun 21, 2016, 1:29:12 PM6/21/16
to fireba...@googlegroups.com
Firebase Storage currently does not work in Node.js and is not included in the Node.js package. It is currently browser-only. You can see the full Node.js reference here. We are working on adding support for Storage in Node.js, but don't have any release dates to share.

Cheers,
Jacob

On Tue, Jun 21, 2016 at 2:20 AM, Muhammad Kamran Qadri <kami....@gmail.com> wrote:
I am unable to find firebase storage on firebase library of nodejs.

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/c2831f3f-c728-457c-a076-573b5f7c558e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mike Mcdonald

unread,
Jun 21, 2016, 3:16:43 PM6/21/16
to Firebase Google Group
We recommend using the GCloud-node library, which has support for Google Cloud Storage, and functions similarly to the Firebase Node.js library.

Thanks,
--Mike

Aurélien C

unread,
Jun 21, 2016, 3:18:45 PM6/21/16
to Firebase Google Group
There is no firebase package at the moment, but you can still use it as a standard Google Cloud Storage bucket.

Here is how:
import gcloud from 'gcloud'; // The google cloud nodejs SDK
const gcs = gcloud.storage({
    projectId
: gcsProject,
    keyFilename
: gcsPrivateKey
});
const bucket = gcs.bucket(`${gcsProject}.appspot.com`);

- gscProject = firebase storage ucket less the '.appspot.com'
- gcsPrivateKey = the service account JSON file you need when accessing firebase from nodejs. You can create one in google console AIM.

Then you can use functions from the gcloud SDK which are very similar to the firebase storage module. (see the docs for the differences)

Please note that you'll have to deal with multiple permissions :
- service account permissions, while accessing your bucket from nodejs (user-12345123451215)
- your google acount individual permissions while manually accessing your data in the google console (user...@domain.tld)
- permissions linked to the firebase project (project-viewers-12345, project-editors-12345, project-owners-12345, 12345 being the ID of your Firebase that you can find in the CLOUD MESSAGING tab in the new Firebase console parameters)

Permissions important to figure out if something's wrong: permission for the bucket, and permissions for default items created in the bucket. Everything is in the google cloud storage console.

I give you those informations about permissions because it took me many hours to figure out which users had which rights on the file, depending on how I was accessing them :)
Reply all
Reply to author
Forward
0 new messages