How can I reference a GCP cloud storage object, from the firebase download link, using the Admin SDK

How can I reference a GCP cloud storage object, from the firebase download link, using the Admin SDK



My question is similar to this: Firebase web: Storage Location from Download URL



I'm writing a firebase function where i need storage location. Right now i have download url:



https://firebasestorage.googleapis.com/v0/b/dxxxxxxxxx.com/o/videosvideo%3A67423?alt=media&token=acxxxxxxxxxxxxxxxxx



Is there a way to get Storage location like this:



gs://dexxxxxxxxxxxxxx.com/videosvideo:67423



The answer given is to do:


const downloadUrl = "https://firestorage.googleapis...";
const gsUrl = firebase.storage().refFromUrl(downloadUrl).toString();



However, the context I'm doing this, is as a Firebase Function - so I need to use the Admin SDK.



The Admin SDK Storage directly references the the GCP Storage Buckets, which don't have refFromUrl().


refFromUrl()



Is there a simple way to do this? The context is - I want to delete the object for the given download link.




1 Answer
1



I don't think there is a server side API that's going to do what you want. I'd recommend storing not just the download URL in your database, but also the path to the file in storage. That way, the server can deal with the file easily through the Admin SDK.






Yes - that is a solution I've considered.

– dwjohnston
Sep 7 '18 at 4:10



Thanks for contributing an answer to Stack Overflow!



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)