When trying to retrieve a list of items that are at a path in firebase storage. The build on iOS throws the following error :
[Error: [storage/unknown] Argument 'maxResults' must be between 1 and 1000 inclusive.]
When executing the following function :
rootRef.child(filePath).list({
maxResults:50
}).then(res => res.prefixes)
maxResults argument was set to 50 in this case.
On Android the same piece of code executes with no issues.
Click To Expand
#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like:
# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
target '___' do
pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
pod 'React', :path => '../node_modules/react-native/'
pod 'React-Core', :path => '../node_modules/react-native/'
pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'
pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
rn_path = '../node_modules/react-native'
# Third party
pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'
pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
pod 'BVLinearGradient', :path => '../node_modules/react-native-linear-gradient'
pod 'rn-fetch-blob', :path => '../node_modules/rn-fetch-blob'
pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info'
pod 'react-native-background-timer', :path => '../node_modules/react-native-background-timer'
pod 'RNSVG', :path => '../node_modules/react-native-svg'
# Required by RNFirebase
pod 'RNFBApp', :path => '../node_modules/@react-native-firebase/app'
pod 'RNFBAuth', :path => '../node_modules/@react-native-firebase/auth'
pod 'RNFBFirestore', :path => '../node_modules/@react-native-firebase/firestore'
pod 'RNFBStorage', :path => '../node_modules/@react-native-firebase/storage'
# Required by Google maps
pod 'GoogleMaps'
pod 'Google-Maps-iOS-Utils'
use_unimodules!
pod 'RNFS', :path => '../node_modules/react-native-fs'
pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-community/async-storage'
target '___tests' do
inherit! :search_paths
# Pods for testing
end
end
#### `AppDelegate.m`:
// N/A
Click To Expand
#### Have you converted to AndroidX? - [ ] my application is an AndroidX application? - [ ] I am using `android/gradle.settings` `jetifier=true` for Android compatibility? - [ ] I am using the NPM package `jetifier` for 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 -->
Click To Expand
**`react-native info` output:**
OUTPUT GOES HERE
- **Platform that you're experiencing the issue on**:
- [X] iOS
- [ ] Android
- [ ] **iOS** but have not tested behavior on Android
- [ ] **Android** but have not tested behavior on iOS
- [ ] Both
- **`react-native-firebase` version you're using that has this issue:**
- `6.0.2`
- **`Firebase` module(s) you're using that has the issue:**
- `Storage`
- **Are you using `TypeScript`?**
- `N`
Very strange. I just looked at the relevant JS and native code including relevant tests and nothing jumps out at me. It all looks like it should work.
The test only tests for maxResults of 1 and it's doing something with pointers there, maybe something is missing w.r.t. testing and if the test did 50 it would expose it
@mikehardy Encountered the same issue. Tried with a clean react-native project and got the same error.
My dependencies:
"dependencies": {
"@react-native-firebase/app": "^6.0.3",
"@react-native-firebase/storage": "^6.0.3",
"react": "16.9.0",
"react-native": "0.61.4"
}
This is probably something to do with the way Objective-C is handling integers. If possible, could you log the value of this line: https://github.com/invertase/react-native-firebase/blob/master/packages/storage/ios/RNFBStorage/RNFBStorageModule.m#L167
@Ehesp it seems to be NULL.

Can you pause it on the next line? Not sure if it's initialised the value there. Also could you expand listOptions?
@Ehesp there you go :)

Yeah looks like a conversion issue - not sure why tests aren't picking this up. Feel free to PR, or we'll get to this at some point soon. Thanks!
@mtsap excellent debug / diagnostics!
When debugging it looks like the value is getting passed down correctly, but for some reason the pointer doesn't return the value properly. (looks like something goes wrong when the value gets read (converted), like @Ehesp said.)
For anyone else having this issue and looking for "a" fix. You can go to line 167 of the RNFBStorageModule.m file.
And replace the pointer 'maxResults' with
long maxResults = [listOptions[@"maxResults"] longValue];
I am aware this is not an ideal solution but for now it passes down the value and i can continue developing 馃槃
I am aware this is not an ideal solution but for now it passes down the value and i can continue developing 馃槃
That probably is the solution to be honest!
@IndySpaan with the 'patch-package' package it's even a great solution across your whole team + CI + releases etc until fixed upstream :-)
Most helpful comment
When debugging it looks like the value is getting passed down correctly, but for some reason the pointer doesn't return the value properly. (looks like something goes wrong when the value gets read (converted), like @Ehesp said.)
For anyone else having this issue and looking for "a" fix. You can go to line 167 of the
RNFBStorageModule.mfile.And replace the pointer 'maxResults' with
long maxResults = [listOptions[@"maxResults"] longValue];I am aware this is not an ideal solution but for now it passes down the value and i can continue developing 馃槃