GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Urgent: Firebase file upload not working · Issue #1388 · googleapis/google-cloud-node

Urgent: Firebase file upload not working #1388

New issue
Copy link
New issue
Copy link
Closed
Closed
Urgent: Firebase file upload not working#1388
Copy link
Assignees
stephenplusplus
Labels
api: storageIssues related to the Cloud Storage API.type: questionRequest for information or clarification. Not an issue.

Description

@wahengchang
wahengchang
opened on Jun 20, 2016
Issue body actions

As showed in npm/firebase, Server side Firebase npm module is not support. Instead, you can use the gcloud Node.js client .
image

///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////

var gcloud = require('gcloud');

var gcs = gcloud.storage({
  projectId: 'firebase-project',
  keyFilename: 'firebase-key.json'
});

var bucket = gcs.bucket('petertest-25efd.appspot.com');

bucket.upload('/photos/zoo/zebra.jpg', function(err, file) {
  if (!err) {
    // "zebra.jpg" is now in your bucket. 
  }
});

///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////

This is the error:

{ [ApiError: Forbidden]
  code: 403,
  errors: [ { domain: 'global', reason: 'forbidden', message: 'Forbidden' } ],
  response: undefined,
  message: 'Forbidden' }

image

Activity

Next
  1. stephenplusplus commented on Jun 20, 2016

    @stephenplusplus
    stephenplusplus
    on Jun 20, 2016
    Contributor
    More actions

    Where did you get firebase-key.json?

  2. jgeewax commented on Jun 20, 2016

    @jgeewax
    jgeewax
    on Jun 20, 2016
    Contributor
    More actions

    Also - does the service account inside firebase-key.json have access to the bucket you're trying to access?

    Reacted by RinwaOwuogba
  3. stephenplusplus
    added
    type: questionRequest for information or clarification. Not an issue.
    api: storageIssues related to the Cloud Storage API.
    on Jun 20, 2016
  4. wahengchang commented on Jun 21, 2016

    @wahengchang
    wahengchang
    on Jun 21, 2016
    Author
    More actions

    I am a user of gcloud for a year, and my upload server have been runing for 6-8month. I did the same as what I did before in google storage, 1- create bucket , 2- create service account and generate key.json , 3- add to node.js project

    Creating service account:
    image

    How the firebase-key.json is generated, after firebase-key.json is generated and will look like .
    image

    How the firebase-key.json is generated.
    image

    The content of firebase-key.json.
    image

    THank a lot

  5. stephenplusplus commented on Jun 22, 2016

    @stephenplusplus
    stephenplusplus
    on Jun 22, 2016
    Contributor
    More actions

    Any ideas @jgeewax?

  6. mziccard commented on Jun 22, 2016

    @mziccard
    mziccard
    on Jun 22, 2016
    Contributor
    More actions

    It might be interesting to know what is the role of peter-2 for the petertest-25efd project. (You should be able to see that at https://console.cloud.google.com/iam-admin/iam). And what are the ACLs for the petertest-25efd.appspot.com bucket (here you can get information on how to retrieve ACLs for a bucket).

  7. jgeewax commented on Jun 22, 2016

    @jgeewax
    jgeewax
    on Jun 22, 2016
    Contributor
    More actions

    Can you see the bucket when you browse the storage browser? If so, can you look at the ACLs and make sure that the service account you created has the "Owner" permission on the bucket?

  8. jgeewax commented on Jun 23, 2016

    @jgeewax
    jgeewax
    on Jun 23, 2016
    Contributor
    More actions

    Any update ? I noticed the issue had "Urgent" in it, so hoping to help get this resolved quickly!

  9. wahengchang commented on Jun 25, 2016

    @wahengchang
    wahengchang
    on Jun 25, 2016
    Author
    More actions

    image

    Hi @mziccard and @jgeewax , because of the deadline, our team decided to use the regular google cloud storage, which we are familiar with and usable. And it will be great to have a config tutorial of storage and firebase, would be very helpful

    Thank you

  10. jgeewax commented on Jun 25, 2016

    @jgeewax
    jgeewax
    on Jun 25, 2016
    Contributor
    More actions

    @mcdonamp -- Can you test this out? Seems weird that things wouldn't work right out of the box....

  11. asciimike commented on Jun 27, 2016

    @asciimike
    asciimike
    on Jun 27, 2016
    More actions

    Firebase Storage is out of the box compatible with Google Cloud Storage, so I'm not really sure why this isn't working.

    In your initialization, I assume you replaced everything appropriately:

    var gcs = gcloud.storage({
      projectId: 'petertest-25efd',
      keyFilename: 'path/to/your/key.json'
    });
    

    Is this a GCP project that you imported to Firebase, or a Firebase project that you created and are now trying to access via GCP?

  12. wahengchang commented on Jun 27, 2016

    @wahengchang
    wahengchang
    on Jun 27, 2016
    Author
    More actions

    1 - created a project and bucket in firebase
    2 - go to console,
    3 - create service-account and download json file
    4 - put it in nodejs project
    5 - run

    should the project created by firebase behave as same as project create on google cloud storage ?

  13. wahengchang commented on Jun 27, 2016

    @wahengchang
    wahengchang
    on Jun 27, 2016
    Author
    More actions

    as my observation, their service-key.json is slightly different:

    ===================== below is service-key.json generated by google project=============

    {
      "private_key_id": "******",
      "private_key": "******",
      "client_email": "******",
      "client_id": "******",
      "type": "service_account"
    }

    =============== below is service-key.json generated by firebase google project=============

    {
      "type": "service_account",
      "project_id": "******",
      "private_key_id": "******",
      "private_key": "******",
      "client_email":  "******",
      "client_id":  "******",
      "auth_uri":  "******",
      "token_uri":  "******",
      "auth_provider_x509_cert_url":  "******",
      "client_x509_cert_url":  "******",
    }
  14. asciimike commented on Jun 27, 2016

    @asciimike
    asciimike
    on Jun 27, 2016
    More actions

    Yes, a Firebase project is also a Google Cloud project, so everything should be interoperable. I have used service-key.json from GCP land, I've never tried the Firebase service-key.json. Try the GCP generated one and see if that works?

  15. 3 remaining items

  16. stephenplusplus
    closed this as completedon Jul 6, 2016
  17. aaronksaunders commented on Jul 25, 2016

    @aaronksaunders
    aaronksaunders
    on Jul 25, 2016
    More actions

    i have this exact same issue... not sure where to log it since you are closing it here... @stephenplusplus @mcdonamp - should this be raised as an issue in Firebase ?

    The project is a new Firebase project that I am trying to access the storage assets from a node.js application. I created the service-account.json using the steps described above

    I did a simple test of manually creating a bucket in the google console and it works fine, but the buckets created by firebase do not work so is this a firebase issue or a google cloud API issue

  18. asciimike commented on Jul 25, 2016

    @asciimike
    asciimike
    on Jul 25, 2016
    More actions

    The best place to route it is probably the Firebase Support channel, where we can triage it. I'm very surprised that the default App Engine bucket (projectid.appspot.com) doesn't work with the service account you created, since I've never had a problem with this. It's possible that the service account you have isn't attached to that bucket, which is why it's failing?

  19. aaronksaunders commented on Jul 25, 2016

    @aaronksaunders
    aaronksaunders
    on Jul 25, 2016
    More actions

    @mcdonamp that is quite possible since I have never worked with Google Cloud directly but I have gone into the specific project and created the service account...

    "service account you have isn't attached to that bucket"

    If there is something specific I need to do to make that happen, I cannot find those instructions in any documentation, is it possible I am missing a step

  20. asciimike commented on Jul 25, 2016

    @asciimike
    asciimike
    on Jul 25, 2016
    More actions

    Comment 9 above shows the bucket permissions, and your service account should be added as an owner/editor of the projectid.appspot.com bucket (depending on how you configured the service account it may or may not be that way). You'll need it on both the default bucket ACLs as well as the default object ACLs.

    The docs on service accounts for GCS buckets are here: https://cloud.google.com/storage/docs/authentication#service_accounts but might not be terribly helpful.

    Reacted by Ethan Tran and Tiago Nunes
  21. nicolasgarnier commented on Oct 11, 2016

    @nicolasgarnier
    nicolasgarnier
    on Oct 11, 2016
    More actions

    I faced the same issue while developing on a GCE instance and found a fix. It seems that some permissions are missing from the *.appspot.com bucket. Here is what I added for this to work:

    image

    On a newly created *.appspot.com bucket the editors-xxxxx and viewers-xxxxx permissions were missing on the bucket permissions and all owners-xxxxx, editors-xxxxx and viewers-xxxxx permissions were missing on the object default permissions.

    You need all these on both the bucket permissions and the object default permissions:

    image

    PS: Obviously you need to adapt the number suffix of owners-, editors- and viewers-, don't use the ID on these screenshots 😄 (I think this must match the numerical ID of your Google Cloud project).

    @mcdonamp I filed a bug internally to ask for the *.appspot.com bucket to automatically get these permissions set on bucket creation.

  22. JustinBeckwith
    assigned
    stephenplusplus
    on Feb 1, 2021
  23. miguelvelezsa
    added a commit that references this issue on Jul 23, 2025

    chore(main): release 3.5.3 (#1388)

    1510609
  24. sofisl
    added a commit that references this issue on Feb 3, 2026

    fix: add missing alias for valid types (#1388)

    e9b28fd
  25. sofisl
    added 4 commits that reference this issue on Feb 24, 2026

    feat: introduces style enumeration (#1388)

    08ec484

    fix: specified acceptable types for File.save data parameter (#1388)

    6813f66

    fix: unknown errors should not be retried (#1388)

    dc10da6

    chore: release 5.8.1 (#1389)

    e195312
  26. GautamSharda
    added a commit that references this issue on Mar 11, 2026

    chore: disable renovate dependency dashboard (#1194) (#1388)

    e889ff8
  27. thiyaguk09
    added a commit that references this issue on Mar 18, 2026

    fix: specified acceptable types for File.save data parameter (googlea…

    7ccbb63
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @stephenplusplus
    stephenplusplus

Labels

api: storageIssues related to the Cloud Storage API.type: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402792 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.