react-native-firebase
                                
                                 react-native-firebase copied to clipboard
                                
                                    react-native-firebase copied to clipboard
                            
                            
                            
                        [🐛] Unable to upload ios live photo to firebase storage
Issue
Currently seeing an issue with uploading live photos to storage. Attempting to do so triggers a storage/unknown error. Upgraded our app to use the latest 15.1.1 release and the underlying reason is 'Can not finalize upload. Current size is 728. Expected final size is 725'. I was able to, in the past, upload live photos with no issue. We are uploading them as a .jpg from the devices which also used to work in the past.
Project Files
Javascript
Click To Expand
package.json:
# N/A
firebase.json for react-native-firebase v6:
# N/A
iOS
Click To Expand
ios/Podfile:
- [ ] I'm not using Pods
- [x] I'm using Pods and my Podfile looks like:
# N/A
AppDelegate.m:
// N/A
Android
Click To Expand
Have you converted to AndroidX?
- [ ] my application is an AndroidX application?
- [ ] I am using android/gradle.settingsjetifier=truefor Android compatibility?
- [ ] I am using the NPM package jetifierfor react-native compatibility?
android/build.gradle:
// N/A
android/app/build.gradle:
// N/A
android/settings.gradle:
// N/A
MainApplication.java:
// N/A
AndroidManifest.xml:
<!-- N/A -->
Environment
Click To Expand
react-native info output:
 OUTPUT GOES HERE
- Platform that you're experiencing the issue on:
- [ ] iOS
- [ ] Android
- [ ] iOS but have not tested behavior on Android
- [ ] Android but have not tested behavior on iOS
- [ ] Both
 
- react-native-firebaseversion you're using that has this issue:- e.g. 5.4.3
 
- Firebasemodule(s) you're using that has the issue:- e.g. Instance ID
 
- Are you using TypeScript?- Y/N&- VERSION
 
- 👉 Check out React Native FirebaseandInvertaseon Twitter for updates on the library.
Just in case anyone has run into this issue, or in general the storage/unknown issues when trying to upload multiple images, it seems to be the size of the images causing this. I think iOS 15.5 introduced a change to photos that made the size of them slightly larger. Compressing the images with react-native-image-resizer seems to have fixed this issue for me.
In my case nothing works (resizing the image), it just doesn't like live photos and some times photos from iCloud.
If someone could provide a sample photo that works, and one that does not work, for comparison, that would help advance this
(https://stackoverflow.com/help/mcve / https://stackoverflow.com/help/how-to-ask)
Currently this issue report is really light on details anyone would need for a definitive reproduction
@mikehardy here you can find 2 pictures (one which works, the other fails)
https://drive.google.com/drive/folders/1ZTUkZ1DYZ4AEeYvlCzcIvcIDZz9PC_e5?usp=sharing
@mikehardy I also had this issue on 14.11.1 but with any photo, doesn't matter if live or not.
This is my upload function:
const uploadImage = async (
  image: { url: string; width: number; height: number },
  // eslint-disable-next-line @typescript-eslint/default-param-last
  contentType = "image/png",
  path: string
) => {
  const filename = new URI(image.url).filename(); // urijs -> https://www.npmjs.com/package/urijs
  const id = nanoid(12);
  await storage()
    .ref(`users/${currentUser().uid}/${path}/${id}_${filename}`)
    .putFile(image.url, {
      cacheControl: "max-age=31536000",
      contentType
    });
  const url = await storage()
    .ref(`users/${currentUser().uid}/${path}/${id}_${filename}`)
    .getDownloadURL();
  if (!url) {
    notify(
      "Unable to get download link for image file",
      "error",
      "Error while getting image download link for image file"
    );
    throw new Error("Unable to get download link");
  }
  return { url: url.replace(":443", ""), width: image.width, height: image.height };
};
The error was something between the lines of: "cannot find storage file ref", when I go back to 14 (I'm working on 2 different versions of my app, one with 15.x and one with 14.x) I'll come back here and paste the proper error message.
edit: haven't seen this error on 15.x yet using the same images. edit2: sorry for the hijack, my issue and this issue is not 100% related but it could be an issue with old iOS Firebase SDK versions.
Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.