issues deleting an image using Cloud Functions for Firebase and @google-cloud/storage

后端 未结 2 815
广开言路
广开言路 2021-02-14 07:56

I\'m trying to create a script in Cloud Functions for Firebase that will react to a db event and remove an image that has its path in one of the params (\"fullPath\").

t

2条回答
  •  忘了有多久
    2021-02-14 08:42

    ok, so i got this solved. here are my conclusions:

    • you need to add to your buckets name the ".appspot.com". Its not written anywhere in the docs and getting your bucket name in firebase is hard enough for someone that is not familiar in the google cloud. I hope they will add this little peace of information into their docs or make it clear what is your bucket's name in firebase.
    • use the environment variable process.env.GCLOUD_PROJECT, it should have your project id that is identical to your bucket id in firebase. again, remember to add the .appspot.com suffix to it.
    • regarding the credentials to GCS, you don't need to provide them when using cloud functions for firebase. you seem to be authenticated already.

提交回复
热议问题