Storage PutFile returns downloadUrl as NULL
Issue
Firebase uploading the file but
Running the below code, will upload the file successfully to firebase storage. HOWEVER it return return downloadUrl as NULL
firebase
.storage()
.ref(path)
.putFile(FILE_URI)
.on(
'state_changed',
snapshot => {},
err => {
console.log(err);
unsubscribe();
},
uploadedFile => {
url = uploadedFile.downloadUrl;
console.log(url);
unsubscribe();
}
);
Environment
- Application Target Platform:Both
- Development Operating System: macOS
- Build Tools: Xcode
React Nativeversion: 0.55React Native FirebaseVersion: 4.2FirebaseModule: Storage- Are you using
typescript? No
@barjas I'd check your storage rules on this, if the downloadUrl is null on the snapshot then that means the currently authenticated user does not have read access to the specified storage path - it can still have write access though.
Also; I'd recommend switching to https://rnfirebase.io/docs/v5.x.x/storage/reference/Reference#getDownloadURL as the url on the snapshot will be removed in a later release as it's non-standard and does not match the firebase js api.
Loving react-native-firebase and the support we provide? Please consider supporting us with any of the below:
- 👉 Back financially via Open Collective
- 👉 Follow
React Native FirebaseandInvertaseon Twitter - 👉 Star this repo on GitHub ⭐️