Storage: Unable to create StorageReference from URL
tuyenit7 opened this issue · 2 comments
I had that issue when moving firebase implementation (Analytics, RealtimeDB, RemoteConfig, Storage) from native android sdk to cpp sdk. Everything seem to be OK but when i tried to get reference by calling GetReferenceFromUrl() it return error: -Unable to create StorageReference from URL - URL specifies a different bucket (firebasestorage.googleapis.com) than this instance ([my custom bucket]). My URL is download URL of Firebase storage (https://firebasestorage.googleapis.com/v0/b/[my custom bucket]/o/ [my file]). Note: it work fine when i using native android SDK. Please help!
The Android implementation actually has a bug that allows you to create a storage reference using a different bucket to the bucket used to create the storage object. In the C++ implementation to be consistent across all platform (Android, iOS & desktop) we make sure that you can't do this on Android even though it's feasibly possible and incorrect. To fix this issue you should instead create a firebase::storage::Storage instance for the bucket then get a references for that bucket from the new instance instead.
Hi, thank you for your explanation. I'd tried follow your suggest successful.
Thanks again!