Closed fungilation closed 6 years ago
@fungilation Are you able to upload a full example somewhere so that we can help you debug it? I've been looking at putFile on iOS but only have code to run through the image / asset upload path, not the specific file upload path.
If I can put something together using your example then I'll be able to help.
Is RNFirebase v3 making changes to interface with Firebase Storage? If so, I should test against that, in giving you a more full and isolated test case.
@fungilation The interface with Firebase Storage is remaining the same in v3 so I just need a full example of generating the JSON file, saving it to disk, then using putFile for me to be able to debug and fix.
Ok I've updated my original post with how exactly I generate the sha3 hash for path name, with the jsSHA package, and pasted a sample result
object (stringified) which is the text to be stored in Firebase.
Let me know @chrisbianca if you need more details still in setting up a reproducible test case. The result
object includes data from both public and private APIs so I think testing on a sample is easier.
Checking in again. Do you still need more details on reproducing?
@fungilation Sorry, things have been a bit hectic our end, but this is very much on my list as soon as we get v3 out of the door in the next couple of weeks... I think there should be enough information available for me to reproduce - I will shout if that's not the case.
Great! I'm not rushing, and I understand you want to take care of v3 first and test/fix against that after release.
@chrisbianca I am facing the same problem. I am uploading an image using RNFirebase v 3.0.2 and instead of the content of the image, the server uploads a jSON with "name","size" and "contentType" keys. The putFile() returns an error "an unknown error has occurred."
Any help to resolve the issue would be welcome
I am having the exact same behavior as @waqqas mentioned. Was there any resolution to this problem?
Bump
This is a cross-post from several related issues where I had commented:
Found it, in my case at least. The URI of the image from the ImagePicker had a % character in it from the local app cache. This percent was being URI encoded to '%25' which resulted in the file not being found by the putFile code. Adding a decodeURI call around the uri fixed the issue.
let fileUri = decodeURI(pickerResult.uri)
Thanks all for reporting this issue and the discussion around it.
We're aware that Storage has fallen behind slightly on React Native Firebase and would like to bring it up to speed again. I will close this issue for now and track it as well as other issues collectively over on the Storage improvements proposal to be addressed in a future release. See #1260
@dethell @fungilation @waqqas; pushed up quite a few fixes/tweaks for storage in preparation for the v4.3.0 release.
The two relevant for this issue are:
Keep and eye out for the v4.3.0 release.
Thanks for the feedback 👌
Fixes now live in the v4.3.0 release.
Loving react-native-firebase
and the support we provide? Please consider supporting us with any of the below:
React Native Firebase
and Invertase
on Twitter Hey @fungilation - just thought you'd like to know the v6 re-write PR is up and well into dev, which includes many improvements including putString()
support - so you'd no longer need to write a file 🎉
PR & Changelog: https://github.com/invertase/react-native-firebase/pull/2043
Environment
I'm at a loss in making Storage work with putFile() (copying https://github.com/invertase/react-native-firebase/issues/170#issuecomment-316345243). My sample code:
Chrome console output from firebase.storage() would always fail, with
Here's a chunk of xcode console output on error. I'm not sure what's "unexpected" about the responses as it says:
FYI, it's not my security rules being the issue, I haven't changed the default rules (below) and I have
firebase.auth().signInAnonymously()
before the storage calls.Looking at my Firebase console, I would see files created at the correct
path
, but with all files with this as content: (instead of the serialized json first written to local file)