-
Notifications
You must be signed in to change notification settings - Fork 1.6k
A few FirebaseStorage bugs on iOS SDK 10 #10374
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
Just a note on item 4 - downloadURL - that was the focus of this PR #10370 - which itself was based on the learnings from @russellwheatley in the FlutterFire v10 integration and my carrying that over to react-native-firebase. 10370 would resolve it in this repo, otherwise there will need to be a PR+release in firebase-tools to resolve it. It also points out a need to perhaps run the test harness here against firebase emulator as a matrix entry if possible, as there are a few gaps like this and they will come and go I'm sure. Also my comment here serves as a subscription, as I collaborated so much with @paulb777 on the storage metadata stuff for firebase-ios-sdk v9 I'm curious if I have any additional changes in react-native-firebase related to this. I did have to do the name/path workaround for putFile as well, for what it's worth. Cheers! |
Number 5 happening to me, which value should I put with the "name" key"? |
@enriqueg use this method to initialise metadata: https://github.com/firebase/flutterfire/blob/master/packages/firebase_storage/firebase_storage/ios/Classes/FLTFirebaseStoragePlugin.m#L803 add this property: https://github.com/firebase/flutterfire/blob/master/packages/firebase_storage/firebase_storage/ios/Classes/FLTFirebaseStoragePlugin.m#L776-L780 It's the full path to the object in your Storage bucket (e.g. "flutter-tests/image.jpg"). |
@russellwheatley Thanks so much, it seems to work! very much appreciated!! |
…thDictionary Debugging the issue updateMetadata method fails to update customMetadata when you initialise metadata with initWithDictionary. #10374
@russellwheatley Do you see number 6 as a regression in 10.0.0? Our testing is showing the same behavior in 8.x and 9.x. |
I am pretty sure (or I hope anyway) that Russell is away from keyboard UK time, however - @russellwheatley you may find the work in react-native-firebase interesting, related to the custom metadata update: invertase/react-native-firebase#6319 is the pull where I went through everything, there is some information in the description This specific commit is the one where I altered the custom metadata style based on collaboration with Paul here - invertase/react-native-firebase@2dcb079 that implementation was only necessary I think after storage went swift in v9 of firebase-ios-sdk and is what prompted me to switch implementation style. The new style implemented in that commit needed no change to work with the new v10 release here I made a corresponding to change to the android implementation so that all 3 platforms (web, apple, android) update customMetadata as a group, so the behavior is coherent cross platform: invertase/react-native-firebase@d602436 test rig to probe conformance, in case it's interesting (you know where these are in general but the link makes it quicker): https://github.com/invertase/react-native-firebase/blob/f2d1363b89fb046388f8336b08852c1ea0c285f2/packages/storage/e2e/StorageReference.e2e.js#L360-L479 |
Thanks, @mikehardy. Based on your PR notes here: invertase/react-native-firebase#6319. I think it might be worth adding more coverage for FlutterFire around setting/deleting metadata as I'm not sure we have the same implementation to cover the different behaviour across platforms.
@paulb777 I think this implies that it isn't a regression but a bug that has been present for a number of releases. I would expect my custom metadata to be updated using this implementation unless I'm missing something? dictionary[@"metadata"] = @{@"foo" : @"bar"};
FIRStorageMetadata *metadata = [[FIRStorageMetadata alloc] initWithDictionary:dictionary];
FIRStorageReference *reference = [self createStorageRef:downloadUrlFile];
[reference updateMetadata:metadata
completion:^(FIRStorageMetadata *updatedMetadata, NSError *error) {
if (error != nil) {
NSLog(@"ERROR: %@", error);
} else {
// custom metadata is not updated "@{@"foo" : @"bar"}".
// It is removed in this line: https://github.com/firebase/firebase-ios-sdk/blob/master/FirebaseStorage/Sources/StorageMetadata.swift#L259
NSLog(@"SUCCESS: %@", updatedMetadata);
}
}]; It's not a deal breaker for FlutterFire either way as we reverted back to setting custom metadata the way we have done previously: FIRStorageMetadata *metadata =[[FIRStorageMetadata alloc] init];
metadata.customMetadata = @{@"foo" : @"bar"};
FIRStorageReference *reference = [self createStorageRef:downloadUrlFile];
[reference updateMetadata:metadata
completion:^(FIRStorageMetadata *updatedMetadata, NSError *error) {
if (error != nil) {
NSLog(@"ERROR: %@", error);
} else {
// custom metadata has been successfully updated and is present in: `updatedMetadata`
NSLog(@"SUCCESS: %@", updatedMetadata);
}
}]; |
@maneesht Will you comment on what should happen? The code looks like it goes out of its way to save the dictionary used to initialize the metadata when it's created via |
Issues 4 and 5 should be addressed in 10.1.0. Issue 6 is still TBD. |
After taking some time to look at this, it seems like Since this can be confusing to users, it might be best to deprecate or thoroughly explain the usage of this method. |
Going to close since most of this has been addressed. If #6 remains a concern, please open another issue. |
Description
I've created a repository with a full reproduction of the issues we experienced trying to integrate FlutterFire with iOS SDK 10. Please see issue reproduction details for the bugs we found. The downloadURL issue may actually be a problem with firebase-tools, not sure.
Reproducing the issue
Here's the repository which illustrates the issues: https://github.com/invertase/ios-sdk-10-issues
Ripped from the README.md of that repository:
To reproduce and what to expect:
downloadUrl
method fails when using it in combination with the Storage emulator. Press the "downloadUrl emulator failure" button to see the error produced. The response includes a metadata object not stringified which I think is the problem. Comment out the emulator initialization and run app again to see a successful response. It does not contain ametadata object.
putFile
method fails when there is no "path" property in metadata. Press the "putFile failure" button to see this error: "Fatal error: Internal error enqueueing a Storage task". It's because path does not exist on metadata which is a read only property. It can be worked around using intializeWithDictionary and adding "name" property as it puts "name" on "path" property hereupdateMetadata
method fails to updatecustomMetadata
when you initialise metadata withinitWithDictionary
. Press the "updateMetadata failure" button to see response does not include updated custom metadata (i.e. "foo":"bar" in this example). If you comment out the way FIRStorageMetadata is initialised here and uncomment here, you will see custom metadata in response.I have more detailed notes on the PR that landed for FlutterFire here
Firebase SDK Version
10.0.0
Xcode Version
14.0.1
Installation Method
CocoaPods
Firebase Product(s)
Storage
Targeted Platforms
iOS
Relevant Log Output
No response
If using Swift Package Manager, the project's Package.resolved
Expand
Package.resolved
snippetReplace this line with the contents of your Package.resolved.
If using CocoaPods, the project's Podfile.lock
Expand
Podfile.lock
snippetThe text was updated successfully, but these errors were encountered: