-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
fix(storage, ios): resolve listAll promise once and only once on error #4688
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/invertase/react-native-firebase/82buvjx4l |
Codecov Report
@@ Coverage Diff @@
## master #4688 +/- ##
==========================================
+ Coverage 88.61% 89.04% +0.44%
==========================================
Files 109 109
Lines 3712 3712
Branches 347 347
==========================================
+ Hits 3289 3305 +16
+ Misses 381 365 -16
Partials 42 42 |
8859913
to
dcb7ace
Compare
Whoa! Very interesting, Do you have an upstream issue logged with the sdk team? I'm okay in principle with workarounds and will review, but only if upstream is aware and I didn't see an issue ref. If I missed it sorry |
I raised an issue with the upstream team although it might make sense to return the items the query was able to fetch as well as the error on iOS (which is something we can't do with promises in JS). In any case, I didn't touch the Android code, this PR aligns behaviors on both platforms (taking Android as a reference). |
@@ -346,6 +346,20 @@ describe('storage() -> StorageReference', function() { | |||
result.prefixes.length.should.be.greaterThan(0); | |||
result.prefixes[0].constructor.name.should.eql('StorageReference'); | |||
}); | |||
|
|||
it('should not crash if the user is not allowed to list the directory', async function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you so much for adding a test to support this change!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! I subscribed to the upstream issue and replaced the code reference in your workaround with the issue link. I also fixed a blank space nit
Crashing in native code is never acceptable so I'm positive on a workaround now that it is being tracked upstream, and this looks like a good workaround.
The test coverage is wonderful, I personally appreciate that as it gives me confidence when doing releases, thank you.
Android E2E is having issues but they are unrelated, and I'm tracking those separately, this is good to merge |
@TPXP deploying as v10.3.1 as I type this, cheers |
Wow, that was fast. Thanks for your responsiveness! <3 |
All the work over the last few months and years of developing test coverage, the last few months stabilizing the CI tests and polishing the release system means it is now very easy to do one of my favorite things: crush crashes :-). Always my pleasure to help crush a native crash. Thanks for the PR. |
Upstream just closed with a PR, tagged for firebase-ios-sdk 7.4.0 |
Description
When calling
listAll
on a forbidden directory, the promise is rejected then RNFirebase tries to resolve it with an empty result, which leads to the following Exception (which I believe would crash the app in production):The root cause is the lack of a
return
on this line of the Firebase iOS SDK : https://github.com/firebase/firebase-ios-sdk/blob/14764b8d60a6ad023d8fa5b7f81d42378d92e6fe/FirebaseStorage/Sources/FIRStorageReference.m#L417This issue does not occur on Android
Related issues
Upstream issue: firebase/firebase-ios-sdk#7197
Release Summary
Checklist
Android
iOS
e2e
tests added or updated inpackages/\*\*/e2e
jest
tests added or updated inpackages/\*\*/__tests__
Test Plan
Try it on your project !
Storage rules
JS Code
The app will crash without this change on iOS.
Think
react-native-firebase
is great? Please consider supporting the project with any of the below:React Native Firebase
andInvertase
on Twitter