0

I am trying to get download url for images stored in Firebase Storage from my Firebase Fuctions Node API. After uploading the image successfully I stored the following in my database: https://firebasestorage.googleapis.com/v0/b/myprojectname.appspot.com/o/${imageFileName}?alt=media

My files are stored in two different folders: profile and title screenshot of firebase storage folders

But when I paste the url from my database in browser it says:

{
  "error": {
    "code": 404,
    "message": "Not Found.  Could not get object",
    "status": "GET_OBJECT"
  }
}

I have allowed to read in Rules section

I tried to find download url from firebase storage it does not seem to have any field like that

I need to store the download url for the image in my database to serve json formatted data as REST api

NOTE: I have not setup any authentications yet.

WHAT I AM TRYING TO ACHIEVE: I am trying to build a blog where each user will have a profile and their collection of posts. All user/posts will be public views and only respected user can edit their content/profile. I am using Firebase Functions with Node as REST API to communicate with my Nuxt app. I need a way to add reference of the 'title image' in 'blog post' so that I can display it in my app.

RiadSaidur
  • 147
  • 2
  • 12
  • Are you saying that you want to generate a URL that anyone can use to download the file from within Cloud Functions? Please edit the question to be more specific about the problem you're trying to solve. – Doug Stevenson Apr 01 '20 at 06:59
  • hey @DougStevenson, thanks for your suggestion. I have added WHAT I AM TRYING TO ACHIEVE in my question. – RiadSaidur Apr 01 '20 at 07:52
  • Can you post some of your code from the cloud functions that access the storage reference? – Amin Apr 01 '20 at 10:08
  • Adding to what @Amin has commented, please also add a screenshot of an example file showing it's URL on your storage. This will help to confirm that the URL itself is not the issue. – Ralemos Apr 01 '20 at 12:10
  • @DougStevenson thanks for the help but one quick question followes [this][1] answer but will this signed url raise any security issue like accessing my other files? I am new to this and thanks for the support [1]: https://stackoverflow.com/questions/42956250/get-download-url-from-file-uploaded-with-cloud-functions-for-firebase – RiadSaidur Apr 01 '20 at 17:18
  • A signed URL works exactly like a normal Firebase download URL. It's fully public access all the time. You will want to make sure it only allows read access, which is what's shown in the dup. – Doug Stevenson Apr 01 '20 at 17:19

0 Answers0