Skip to content

Images uploaded through Firebase Admin SDK not displaying properly in the Firebase Console #694

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
paulsUsername opened this issue Nov 1, 2019 · 24 comments
Assignees

Comments

@paulsUsername
Copy link

[REQUIRED] Step 2: Describe your environment

Mac OS 10.14.6
firebase-admin : 8.7.0
Firebase Admin SDK
Firebase Storage
Node v10.16.0
Npm 6.12.0

[REQUIRED] Step 3: Describe the problem

I am uploading images to Firebase Storage from a Node.js app that I have built. The upload seems to go fine, but any image upload through the Firebase Admin SDK will not open in the Firebase Console. If I try clicking on the image I get:

`404. That’s an error.

The requested URL was not found on this server. That’s all we know.`

In the Firebase console detail inspector, it just infinitely spins showing a loading progress bar.

If I inspect the image through Google Cloud Console, the image opens fine.

I have not tested downloading the image from an app or through the Firebase Admin SDK to see if it works.

Steps to reproduce:

Upload an image using the Node JS Firebase Admin SDK. I have tried this to multiple directories and I get the same issue every time.

Relevant Code:

await FirebaseAdmin.storage().bucket().upload(`./ImageName/${ImageName}.png`, {destination: `Image/${ImageName}/${ImageName}.png`, gzip: true, contentType: "image/png", metadata: {contentType: "image/png"}})
@google-oss-bot
Copy link

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@paulsUsername
Copy link
Author

Just an extra note in relation to:

contentType: "image/png", metadata: {contentType: "image/png"}

I have added and removed many combinations of this, all with the same result as above.

@paulsUsername
Copy link
Author

Update, its working to download the images through the Firebase iOS sdk and display in an app, but when trying to download the image on our ruby back end (using admin privileges) it's getting an MD5 verification error.

@arjunyel
Copy link
Contributor

Try updating the storage library, heres my PR #702

@paulsUsername
Copy link
Author

The issue is actually an issue in Firebase Console UI

@hiranya911
Copy link
Contributor

It doesn't look like there's anything that we can do in this repo to fix this issue. If it's indeed an issue with the Console, please file a support issue at https://firebase.google.com/support

@msvargas
Copy link

msvargas commented Feb 6, 2020

Hi,
I was have same error, review google cloud console if very simple, no display in console because firebase console need firebaseStorageDownloadTokens, check example:

first install : npm install uuid

    bucket.upload(filename, {
      destination,
      metadata: {
          metadata :{
            firebaseStorageDownloadTokens: uuidv4(),
         }
      },
    })

@rphlmr
Copy link

rphlmr commented Feb 24, 2020

@Punisher97 Thank you so much !

@MFauZ
Copy link

MFauZ commented Apr 3, 2020

@Punisher97 is there a way to do this in Python?

Hi,
I was have same error, review google cloud console if very simple, no display in console because firebase console need firebaseStorageDownloadTokens, check example:

first install : npm install uuid

    bucket.upload(filename, {
      destination,
      metadata: {
          metadata :{
            firebaseStorageDownloadTokens: uuidv4(),
         }
      },
    })

Is there a way to do this in Python? My code is currently:

localImage = 'generated_codes/' + qrString + '.png'
imageBlob = bucket.blob(qrString + '.png', )
imageBlob.upload_from_filename(localImage)

@msvargas
Copy link

msvargas commented Apr 4, 2020

@Punisher97 is there a way to do this in Python?

Hi,
I was have same error, review google cloud console if very simple, no display in console because firebase console need firebaseStorageDownloadTokens, check example:
first install : npm install uuid

    bucket.upload(filename, {
      destination,
      metadata: {
          metadata :{
            firebaseStorageDownloadTokens: uuidv4(),
         }
      },
    })

Is there a way to do this in Python? My code is currently:

localImage = 'generated_codes/' + qrString + '.png'
imageBlob = bucket.blob(qrString + '.png', )
imageBlob.upload_from_filename(localImage)

Sorry i don't known, if you solve, please share :)

@ShakeelAhmadDev
Copy link

Complete Code Snippet to Send Image on firebase(Storage) in Node.js ?

@valle-xyz
Copy link

It doesn't look like there's anything that we can do in this repo to fix this issue. If it's indeed an issue with the Console, please file a support issue at https://firebase.google.com/support

Come one, guys. You need external users to forward a breaking issue to another google team?

@hiranya911
Copy link
Contributor

hiranya911 commented May 19, 2020

Come one, guys. You need external users to forward a breaking issue to another google team?

Yes, because the folks who are working on those parts of the platform are not watching or following these repos. They have their established ways of tracking and managing issues, just as the SDK teams (us) track issues on these open source repos :)

In general if an issue on an open source repo is not relevant to the code in that repo, we will direct the reporter towards Firebase Support and close off the issue. To quote from the GitHub issue template we ask users to fill out:

[READ] Step 1: Are you in the right place?

  • For issues related to the code in this repository file a Github issue.
    ...
  • For help troubleshooting your application that does not fall under one
    of the above categories, reach out to the personalized
    Firebase support channel.

@valle-xyz
Copy link

Nor the other way around? ;-P

I found this quite helpful: googleapis/nodejs-storage#697 (comment)

@hiranya911
Copy link
Contributor

hiranya911 commented May 19, 2020

Nor the other way around? ;-P

Indeed :)

It's a very large platform (Firebase+GCP) and no one team can keep track of the all the feedback we receive on different components. That's why we often refer developers to Support, because they do have the necessary tools and processes to triage issues and direct them to the right teams while taking the global context into consideration.

I found this quite helpful: googleapis/nodejs-storage#697 (comment)

That issue is more about the functionality gap that exists today between Firebase Storage (client) and GCS (admin) SDKs. We have received a lot of feedback on this case from both sides, and also from the Cloud Functions side where this often shows up. There's already a cross-team effort to address it in the long run.

But this particular issue (#694) seems to be related to Firebase Console (console.firebase.google.com). If it is an ongoing problem, then it's best to file a separate support issue for that so it shows up in Console team's radar.

@valle-xyz
Copy link

Hey,

thank you very much for your long answer, even if it is off-topic in this thread. :-)

I really appreciate your effort to explain some insights and I also love firebase and the google cloud.

Google seems to have a lot of great talent inhouse, so it might be complicated for an non-googler like me to follow track of all the different departments and repositories. I did not quite totally get the line between firebase and the google cloud to name an example. And this is not my goal. My goal is to build great products easily, and this is why I use firebase: because it is much more easy to use than AWS.

So getting an issue like this, or googleapis/nodejs-storage#697 is irritating to me, especially when no easy solution seems to be around and this seems to root in the communication friction of the google departments. I don't know the actual goal of firebase or google cloud, but if it is to make developers use their API and thus to make developers life easier, I see some low hanging fruits here. :-)

Still: Thanks a lot for the explanation and I really respect the level of code quality I constantly see in google products.

@hiranya911
Copy link
Contributor

Thanks for voicing your feedback @Valentin-Seehausen. And please continue to do so in the future too. Developer feedback really helps us understand and prioritize the areas that need attention.

The particular issue at googleapis/nodejs-storage#697 has been a thorn in the side of many Firebase devs for a while. Unfortunately our response to it has been slow due to the involvement of code outside the Firebase org boundary. Anyway the good news is, both us (Firebase) and the related GCP teams have received a lot of feedback from developers on this issue, and now there's finally a joint effort to address it. I'm hopeful we can find a solution that all stakeholders are happy with, so please stay tuned.

Again, thanks very much for the comments, and please keep the feedback coming :)

@Abu-muhab
Copy link

Hi,
I was have same error, review google cloud console if very simple, no display in console because firebase console need firebaseStorageDownloadTokens, check example:

first install : npm install uuid

    bucket.upload(filename, {
      destination,
      metadata: {
          metadata :{
            firebaseStorageDownloadTokens: uuidv4(),
         }
      },
    })

You literally just saved my life with this. Thanks!!!!!

@isomorpheric
Copy link

Hi,
I was have same error, review google cloud console if very simple, no display in console because firebase console need firebaseStorageDownloadTokens, check example:

first install : npm install uuid

    bucket.upload(filename, {
      destination,
      metadata: {
          metadata :{
            firebaseStorageDownloadTokens: uuidv4(),
         }
      },
    })

THANK YOU!!!!!!!!!!!!!!!!

@fauzulkc
Copy link

fauzulkc commented Nov 18, 2020

Hi,
I was have same error, review google cloud console if very simple, no display in console because firebase console need firebaseStorageDownloadTokens, check example:

first install : npm install uuid

    bucket.upload(filename, {
      destination,
      metadata: {
          metadata :{
            firebaseStorageDownloadTokens: uuidv4(),
         }
      },
    })

You saved Hours! Awesome man.

@anhpt97
Copy link

anhpt97 commented Dec 1, 2020

Hi,
I was have same error, review google cloud console if very simple, no display in console because firebase console need firebaseStorageDownloadTokens, check example:

first install : npm install uuid

    bucket.upload(filename, {
      destination,
      metadata: {
          metadata :{
            firebaseStorageDownloadTokens: uuidv4(),
         }
      },
    })

Thank you so muchhh! <3

@LarsOlt
Copy link

LarsOlt commented Feb 10, 2021

      metadata: {
          metadata :{
            firebaseStorageDownloadTokens: uuidv4(),
         }
      },

Thanks, works!

@tettoffensive
Copy link

Is this workaround still needed in Firebase Admin 10?

@xcrsx
Copy link

xcrsx commented Aug 7, 2023

@Punisher97 is there a way to do this in Python?

Hi,
I was have same error, review google cloud console if very simple, no display in console because firebase console need firebaseStorageDownloadTokens, check example:
first install : npm install uuid

    bucket.upload(filename, {
      destination,
      metadata: {
          metadata :{
            firebaseStorageDownloadTokens: uuidv4(),
         }
      },
    })

Is there a way to do this in Python? My code is currently:

localImage = 'generated_codes/' + qrString + '.png'
imageBlob = bucket.blob(qrString + '.png', )
imageBlob.upload_from_filename(localImage)

Hey! Sorry, have you found a way to do this?

upd:
for those who will need it:

import uuid

token = uuid.uuid4()
# getting file_blob
file_blob.metadata = {"firebaseStorageDownloadTokens": token}
# upload file to storage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests