-
Notifications
You must be signed in to change notification settings - Fork 2.3k
[docs][storage] missing documentation #170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Was the issue around multiple responses sorted? You know the web SDK could do promises, callbacks etc? |
@Ehesp believe so - also made this issue based on feed back from discord |
@Salakar, I don't know if this is a documentation issue or something else with the Storage api. But I'm at a loss in making Storage work with putFile(). My sample code: import RNFS from 'react-native-fs'
import RNFirebase from 'react-native-firebase'
const firebase = RNFirebase.initializeApp({ debug: false, persistence: true })
firebase.database().goOnline()
firebase.auth().signInAnonymously()
// create a path you want to write to. contentHash is a sha3 hash of result.content
var path = `${RNFS.DocumentDirectoryPath}/${contentHash}.json`
// write the file. result is an object
RNFS.writeFile(path, JSON.stringify(result), 'utf8')
.then((success) => {
console.log('FILE WRITTEN at ', path)
})
.catch((err) => {
console.log('Write error:', err.message, err.code)
})
firebase.storage()
.ref('/resultJsonByContentHash/' + contentHash)
.putFile(path)
.then(uploadedFile => {
console.log('Uploaded to firebase:', uploadedFile)
})
.catch(err => {
console.log('Firebase putFile error:', err)
})
RNFS.unlink(path) Chrome console output from firebase.storage() would always fail, with
Looking at my Firebase console, I would see files created at the correct
Am I missing something? |
@fungilation This does seem strange. There should be an error in the native console for the part of the native code that corresponds to the JS error you've included above. Are you able to take a look and attach that so we have something to work with? Also, are you 100% sure that the file is written correctly by RNFS and it isn't actually writing the content that's being uploaded? Perhaps use RNFS to read the file you've created and check that it is what you'd expect? I'm only using |
Thanks for the quick response! What do you mean by native console. In xcode attached to running app? Yes I'm 100% sure the local file is written correctly with serialised json. I haven't pasted more of my code which read out the file on the same path. |
Yep, Xcode should have some logs corresponding to the error being reported on the JS side |
Here's a chunk of xcode console output. I'm not sure what's "unexpected" about the responses as it says but you'd have better idea:
FYI, it's not my security rules being the issue, I haven't changed the default rules (below) and I have service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write: if request.auth != null;
}
}
} |
Bump. I want to debug this, if I can help. Any idea about the Xcode error output? |
v3 docs are being updated for storage, check out the releases once it's done. |
Closing this as we've got internal tasks for documentation. |
Storage docs are a bit empty and there are several undocumented methods.
Could do with adding those and also expanding on the full upload/download process from start to finish, documenting the provided statics and documenting the metadata object returned from putFile / downloadFile.
The text was updated successfully, but these errors were encountered: