react-native-firebase icon indicating copy to clipboard operation
react-native-firebase copied to clipboard

Storage PutFile returns downloadUrl as NULL

Open creative-git opened this issue 8 years ago • 1 comments

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

  1. Application Target Platform:Both
  2. Development Operating System: macOS
  3. Build Tools: Xcode
  4. React Native version: 0.55
  5. React Native Firebase Version: 4.2
  6. Firebase Module: Storage
  7. Are you using typescript? No

creative-git avatar Jul 25 '18 02:07 creative-git

@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:

Salakar avatar Jan 04 '19 00:01 Salakar