-
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
[🐛⚠️] iOS Build Fails - Value of optional type '?' must be unwrapped to refer to member 'storage' of wrapped base type 'any StorageProvider' (Optional Chaining) #7666
Comments
Yes. I just got exactly the same error today, while everything worked fine last week. I am using Expo 49 SDK. The following is a part of my package.json. "dependencies": { Given the error, "value of optional type '?' must be unwrapped to refer to member 'storage' of wrapped base type 'any StorageProvider", which indicates that the Swift compiler expects an optional value to be unwrapped before its properties or methods can be accessed, I think that it is more about the Firebase Storage SDK's internal handling of values than our project's code directly. I hope someone can help. Thanks |
Yep, it’s a minimal issue with nils handling. Hope it’s fixed soon 🥺 I downgraded the package too but nothing. Did you try @17.5.0? @geoffcfchen Starting to think the issue itself is in the latest Google Firebase iOS SDK package and not directly in this wrapper for React Native (?). |
Yep, i assume its an already fixed issue in Firebase iOS sdk firebase/firebase-ios-sdk#12391 guard let provider = ComponentType<StorageProvider>.instance(for: StorageProvider.self,
in: app.container) else {
fatalError("No \(StorageProvider.self) instance found for Firebase app: \(app.name)")
}
return provider.storage(for: Storage.bucket(for: app, urlString: url)) |
@VictorioMolina could you share how you solve this issue? Just reinstall react-native-firebase/storage? I am using expo EAS build right now and would appreciate it if you could share some advice. Thanks! |
No I did not try 17.5.0... |
Thanks for sharing the information. It seems to me that this problem is still not resolved. It was fine last week but now it can't work, so I think that there are some changes under the hood. I hope some one can point us in a direction... Btw, how do you know it is related to firebase/firebase-ios-sdk#12391? |
@geoffcfchen take a look at the changes introduced on FirebaseStorage/Sources/Storage.swift in this commit: firebase/firebase-ios-sdk@1ed6d66 That’s why I feel we need to update the firebase iOS sdk to a greater version than v10.21.0 |
I see. Since I am working on the expo project, I only have the following packages in my package.json
and the following plugins in app.json.
But I think that we encountered the same issue. I don't think that we are the only one. Those who used the EAS build recently should also encounter the same issue... |
@geoffcfchen It’s correct, it seems impossible to build with expo in the current state. Ignore the custom config plug-in I was implementing, it’s not working and looks like a hack which could lead to extra problems… definitively, not a good solution, I am deleting it. We will need to wait for the package maintainers. |
Someone mentioned a solution https://stackoverflow.com/questions/78027770/upgrading-to-expo-50-can%C2%B4t-build-ios But it requires ejecting from Expo... |
@geoffcfchen It's not the same issue but I also faced it today. "plugins": [
"@react-native-firebase/app",
"./src/plugins/maps/withReactNativeMaps",
"./src/plugins/splash/withAndroidSplashScreen",
[
"expo-build-properties",
{
"android": {
"compileSdkVersion": 34,
"targetSdkVersion": 34,
"buildToolsVersion": "34.0.0",
"extraProguardRules": "-keep class com.google.android.gms.internal.consent_sdk.** { *; }"
},
"ios": {
"deploymentTarget": "13.4", <-------- Just upgrade the minimum deployment target for iOS
"useFrameworks": "static"
}
}
],
[
"expo-notifications",
{
"icon": "./assets/images/logo/notification/notification-icon.png",
"color": "#ffffff"
}
]
], There is no need to eject to the bare workflow, you can stay managed or semi-managed with EAS. |
Maybe a related post |
I don't using expo, i use cli and the error occurs there too |
@geoffcfchen yep, it’s the same issue. Also, it seems the solution is just to upgrade the firebase iOS sdk version, but, as I mentioned before, I feel it’s not the best approach to touch the Podfile with an expo plugin. It’s better to wait for the maintainers of react-native-firebase. |
any updates? |
1 similar comment
any updates? |
@AleshkovDenis @vladi-klmv I submitted a pull request to fix the issue. Pls, check it out and if you think something is missing, update it :) or create a patch package. This issue is strongly retaining us. |
@VictorioMolina |
@AleshkovDenis Nop, I didn't, just prefer to wait for any updates on this repo. But if you do, let us know if the sdk version upgrade fixes the issue. |
@VictorioMolina and @AleshkovDenis - the sdk version upgrade does fix the issue when you patch the package. If anyone would like to use this solution while we wait on the official update, it's very straightforward with a tool like patch-package, or if you use yarn v2+ or pnpm, those have built-in support for package patching. Here's how I did it on Yarn v2+ (I use 4.0.2):
|
@cwackerfuss |
@AleshkovDenis check the changed files in the pull request. #7668 |
node_modules/@react-native-firebase/app/package.json |
Hi, I'm running into the same Fastlane issues with Firebase Storage. I tried to do the patch-package command (yarn patch-package @react-native-firebase/app) but got this message: patch-package 8.0.0 Does anyone know what to do in this case? Thank you! |
yarn patch-package @react-native-firebase/app --exclude |
For those who are working on an Expo project (Expo's managed workflow) and need to fix the EAS building error right now before the official updates, you can do
|
A workaround I'm using is to pin the related pods via a config plugin. It does require knowing what pods to pin and at what versions. I figured out which pods and versions to use by pasting the output of the pod install steps for a working build and a failing build in a text differ.
|
@GibbyBox shouldn’t it be 10.22.0/10.23.0? |
With what I encountered it was 10.22.0 giving me these issues. I can certainly upgrade to 10.23.0, but decided to roll back. I was unaware of this discussion until recently. I even built a repro for this. https://github.com/GibbyBox/repro-firebase-pods-issue-3-5-2024 |
@GibbyBox The issue got solved here, in v10.22.0 firebase/firebase-ios-sdk@1ed6d66 Currently, react-native-firebase wraps firebase-ios-sdk v10.21.0 https://github.com/invertase/react-native-firebase/blob/main/packages/app/package.json Could you please re-check? Is it compiling correctly with the extra pods solution? No crashes while testing the app? |
@VictorioMolina I'm positive. The pods I rolled back to are what's being used in my production app currently. |
So I double checked the install pods log for the attempt that failed. There is a mix of using v10.21.0 and v10.22.0 for the firebase related pods.
Show the entire log
|
In that flutterfire issue you linked, there is this firebase/flutterfire#12429 (comment)
@VictorioMolina Can you double check what version of the pods are installed in your failing builds, specifically if there is a mismatch in FirebaseCoreExtension, FirebaseCore, and FirebaseStorage? What's likely happening on EAS for us is that FirebaseCoreExtension is on the 10.22.0. The interface defined in it indicate that the provider is nullable, but then the implementations in FirebaseCore and FirebaseStorage are on the 10.21.0 where it's missing the change to handle it being nullable. Having all of them on the same version is the solution. Your PR should do that. |
@GibbyBox Thank you for your workaround!! Could you please share the final state of the extra pods? AFAIK, the problem with nils is in the storage package. |
In your podfile works Specify the new version of firebase sdk 10.22.0 |
Thanks @womj its works. |
Show the entire log
Just to be clear, I believe the build issue isn't because of v10.22.0 but because all of the modules are not on the same version. Absolutely use v10.22.0 as it fixes a runtime issue. I tried pinning the related modules to v10.22.0 instead but ran into the following build error.
Resolving this would requiring patching firebase as described in earlier comments. At that point, you do not need to pin the pods via the config plugin. I'm asking on the expo discord server if there is a way to add globals to the podfile with a config plugin to implement what @womj suggested. That workaround is better as it does not require knowledge of the exact firebase pods that are installed for any project. |
Hi there! 👋 Sorry for the delayed response here. I'm qualifying the firebase-ios-sdk 10.22.0 right now for release, but I was under the impression you can easily override the firebase-ios-sdk version as documented here: ...and as mentioned @womj here #7666 (comment) ? Is there some reason that doesn't work for expo folks to get people moving? Someone else mentioned that there is a mix of 10.21.0 and 10.22.0 pods coming down when you specify "10.21.0" as the Firebase version, that's because some of the pods are brought in as transitive dependencies and their semver requirement for the transitive dependency allows cocoapods to resolve higher minor version numbers. This is normal, and should not cause problems. |
I think that for those who use Expo's managed workflow, direct access to iOS and Android native project files is abstracted away, meaning they don't modify the Podfile or any native code directly. This limits the ability to specify or override the Firebase iOS SDK version. In any case, thank you @mikehardy @VictorioMolina for solving this issue. |
@geoffcfchen I see - I do understand that, I guess I assumed (incorrectly) there would be some sort of Expo plugin somewhere that was fairly standard where you could express the idea "Hey, just add this one raw line to the Podfile at the top" 🤷 Either way, yes, react-native-firebase 19.0.1 is out with @VictorioMolina's PR bumping us to firebase-ios-sdk 10.22.0 in place and it handles the new Xcode's "we issue breaking changes in minor version all the time, enjoy" version update |
I am still having this issue in April. Just ran into it. Has there been any updates or movement on this? I am about to try the patch package but I dont want to do that... "@react-native-firebase/app": "^18.9.0", |
Looks like I resolved this with getting the latest version of react-native-firebase version 19.2.2 |
Scenario
Last week I was able to compile my project (Expo EAS Build) without errors.
Today, without modifying anything (didn't upgrade any dependency), I have started getting this error on my iOS AdHoc compilation:
Run Fastlane Errors
Package Versions
Since I was using the following dependencies
I decided to upgrade to the latest one
@^19.0.0
.I have also tried upgrading EAS with Expo 48, 49 and the latest release and images, with CocoaPods v1.15.2, and the error still persists.
Is anyone experiencing the same issue?
The text was updated successfully, but these errors were encountered: