diff --git a/docs/faqs-and-tips.mdx b/docs/faqs-and-tips.mdx index a3162aa0eb..723f0969c0 100644 --- a/docs/faqs-and-tips.mdx +++ b/docs/faqs-and-tips.mdx @@ -98,5 +98,5 @@ To view the complete detail for this solution, please refer to this page: [#5656 - Build processes are costly and complex, so caching is used a lot. As a result, certain changes that you make in your app can cause cache conflicts in subsequent builds. Deal with this via `npx react-native-clean-project`. This does solve a lot of problems. - Try and isolate the problem with a template React Native Firebase app. This [bash script](https://github.com/mikehardy/rnfbdemo/blob/main/make-demo.sh) is particularly helpful in making an empty template app. - Advice on supporting multiple environments (for example, dev, prod, maybe also staging, qa) for your React Native Firebase App: [#3504](https://github.com/invertase/react-native-firebase/issues/3504) -- Using [Fastlane for iOS deployment](https://docs.fastlane.tools/getting-started/ios/setup/) together with [RN Firebase Crashlytics](https://rnfirebase.io/crashlytics/usage) within CI has been observed to cause builds that hang indefinitely. Using `setup_ci(force: true)` before building the application may solve the issue.: [#3706](https://github.com/invertase/react-native-firebase/issues/3706) +- Using [Fastlane for iOS deployment](https://docs.fastlane.tools/getting-started/ios/setup/) together with [RN Firebase Crashlytics](/crashlytics/usage) within CI has been observed to cause builds that hang indefinitely. Using `setup_ci(force: true)` before building the application may solve the issue.: [#3706](https://github.com/invertase/react-native-firebase/issues/3706) - Be careful if you are using a VPN, Google blocks many VPN IPs causing "unavailable" errors for various firebase API calls, and on an Android emulator it might completely mess up the network adapter causing network calls to never return, not only on firebase but on the entire emulated phone. diff --git a/docs/index.mdx b/docs/index.mdx index ed73247bd6..dcc1f76ee1 100644 --- a/docs/index.mdx +++ b/docs/index.mdx @@ -360,12 +360,12 @@ Open your projects `/ios/Podfile` and add any of the globals shown below to the ```ruby # Override Firebase Apple SDK SPM exact pin if desired (see /ios-spm) -$FirebaseSDKVersion = '13.1.0' +$FirebaseSDKVersion = '13.1.1' ``` Once changed, reinstall your projects pods via pod install and rebuild your project with `npx react-native run-ios`. -Alternatively, if you cannot edit the Podfile easily (as when using Expo), you may add the environment variable `FIREBASE_SDK_VERSION=13.1.0` (or whatever SPM exact pin you need) to the command line that installs pods. For example `FIREBASE_SDK_VERSION=13.1.0 yarn expo prebuild --clean` +Alternatively, if you cannot edit the Podfile easily (as when using Expo), you may add the environment variable `FIREBASE_SDK_VERSION=13.1.1` (or whatever SPM exact pin you need) to the command line that installs pods. For example `FIREBASE_SDK_VERSION=13.1.1 yarn expo prebuild --clean` ### Android Performance diff --git a/docs/ios-spm.mdx b/docs/ios-spm.mdx index 45ec74f7fa..b21904d047 100644 --- a/docs/ios-spm.mdx +++ b/docs/ios-spm.mdx @@ -13,7 +13,7 @@ This changes only how the native Firebase SDK is installed; your JavaScript and native application code do not change. Firebase Apple SDK **13.0.0 and later are no longer distributed through -CocoaPods**. The last CocoaPods release is **12.19.0**. See Google's +CocoaPods**. The last CocoaPods release is **12.19.3**. See Google's [CocoaPods deprecation guide](https://firebase.google.com/docs/ios/cocoapods-deprecation). ## Requirements and defaults @@ -25,7 +25,7 @@ CocoaPods**. The last CocoaPods release is **12.19.0**. See Google's - SPM requires CocoaPods 1.10 or newer for the React Native pod integration. React Native 0.75+ templates already satisfy this requirement. - SPM pins the Firebase iOS SDK to the exact version in - `sdkVersions.ios.firebase` in `@react-native-firebase/app` (currently **13.1.0**). + `sdkVersions.ios.firebase` in `@react-native-firebase/app` (currently **13.1.1**). SPM requires dynamic framework linkage: diff --git a/packages/app/firebase_spm.rb b/packages/app/firebase_spm.rb index 2a7f3c3821..c638a144ec 100644 --- a/packages/app/firebase_spm.rb +++ b/packages/app/firebase_spm.rb @@ -180,7 +180,7 @@ def reset! # Firebase iOS SDK as a Swift Package dependency. # # Firebase Apple SDK 13+ is distributed exclusively through SPM and binary -# zips — CocoaPods trunk stopped at 12.19.0. `$RNFirebaseDisableSPM = true` +# zips — CocoaPods trunk stopped at 12.19.3. `$RNFirebaseDisableSPM = true` # and Expo `disableSPM: true` therefore fail `pod install` / prebuild loudly # instead of declaring missing CocoaPods Firebase 13 pods. # diff --git a/packages/app/ios/RNFBFirebase/Package.swift b/packages/app/ios/RNFBFirebase/Package.swift index 275445288d..3ce629adab 100644 --- a/packages/app/ios/RNFBFirebase/Package.swift +++ b/packages/app/ios/RNFBFirebase/Package.swift @@ -28,7 +28,7 @@ let package = Package( dependencies: [ .package( url: "https://github.com/firebase/firebase-ios-sdk.git", - exact: "13.1.0" + exact: "13.1.1" ), ], targets: [ diff --git a/packages/app/package.json b/packages/app/package.json index e353782e60..da48f3c900 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -131,7 +131,7 @@ }, "sdkVersions": { "ios": { - "firebase": "13.1.0", + "firebase": "13.1.1", "firebaseSpmUrl": "https://github.com/firebase/firebase-ios-sdk.git", "iosTarget": "15.0", "macosTarget": "11.0", diff --git a/packages/crashlytics/__tests__/ios_config.test.ts b/packages/crashlytics/__tests__/ios_config.test.ts index e3fb9b6992..977e76bcf8 100644 --- a/packages/crashlytics/__tests__/ios_config.test.ts +++ b/packages/crashlytics/__tests__/ios_config.test.ts @@ -46,6 +46,13 @@ echo "error: stub forced failure" >&2 exit 1 `; +// Never returns on its own — simulates a stalled network request in upload-symbols. +// `exec` keeps this a single process like the real binary, so the timeout's SIGALRM +// kills the hang itself rather than an orphaned child holding the output pipes open. +const HANGS_STUB = `#!/usr/bin/env bash +exec sleep 60 +`; + const ALWAYS_SUCCEEDS_STUB = `#!/usr/bin/env bash exit 0 `; @@ -90,12 +97,13 @@ describe('Crashlytics ios_config.sh SPM dSYM upload', function () { rmSync(projectDir, { recursive: true, force: true }); }); - function runIosConfig() { + function runIosConfig(extraEnv: Record = {}) { return spawnSync('bash', [SCRIPT_PATH], { cwd: projectDir, encoding: 'utf8', env: { PATH: process.env.PATH, + ...extraEnv, PROJECT_DIR: projectDir, TARGET_NAME: targetName, BUILD_DIR: buildDir, @@ -157,6 +165,24 @@ describe('Crashlytics ios_config.sh SPM dSYM upload', function () { expect(result.stdout).toContain('warning:'); expect(result.stdout).toContain('upload-symbols (SPM) failed'); }); + + it('warns and continues without failing the build when SPM upload-symbols hangs past the timeout', function () { + const targetFolderPlist = join(projectDir, targetName, 'GoogleService-Info.plist'); + mkdirSync(join(projectDir, targetName), { recursive: true }); + writeFileSync(targetFolderPlist, 'plist-contents'); + + writeFileSync(uploadSymbolsPath, HANGS_STUB); + chmodSync(uploadSymbolsPath, 0o755); + + const startedAt = Date.now(); + const result = runIosConfig({ RNFB_CRASHLYTICS_UPLOAD_TIMEOUT_SEC: '1' }); + const elapsedMs = Date.now() - startedAt; + + expect(result.status).toBe(0); + expect(elapsedMs).toBeLessThan(30000); + expect(result.stdout).toContain('warning:'); + expect(result.stdout).toContain('failed or timed out'); + }); }); describe('Crashlytics ios_config.sh CocoaPods / framework run', function () { diff --git a/packages/crashlytics/ios_config.sh b/packages/crashlytics/ios_config.sh index 80a28af85d..02c4d70941 100755 --- a/packages/crashlytics/ios_config.sh +++ b/packages/crashlytics/ios_config.sh @@ -16,6 +16,16 @@ # set -e +# upload-symbols talks to the network and has no timeout of its own, so a stalled +# request can hang the whole build. perl's alarm is used because macOS has no +# `timeout`. A timeout exits non-zero, which the callers below report as a +# warning without failing the build. +UPLOAD_SYMBOLS_TIMEOUT_SEC="${RNFB_CRASHLYTICS_UPLOAD_TIMEOUT_SEC:-300}" + +run_upload_symbols() { + perl -e 'alarm shift; exec @ARGV' "${UPLOAD_SYMBOLS_TIMEOUT_SEC}" "$@" +} + if [[ ${PODS_ROOT} && -f "${PODS_ROOT}/FirebaseCrashlytics/run" ]]; then echo "info: Exec FirebaseCrashlytics Run from Pods" if ! "${PODS_ROOT}/FirebaseCrashlytics/run"; then @@ -49,14 +59,14 @@ else echo "warning: GoogleService-Info.plist not found at ${PROJECT_DIR}/${TARGET_NAME}/GoogleService-Info.plist or ${PROJECT_DIR}/GoogleService-Info.plist. Skipping dSYM upload." elif [[ -x "${SPM_UPLOAD_SYMBOLS}" ]]; then echo "info: Exec FirebaseCrashlytics upload-symbols from SPM" - if ! "${SPM_UPLOAD_SYMBOLS}" -gsp "${GSP_PATH}" -p ios "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}"; then - echo "warning: FirebaseCrashlytics upload-symbols (SPM) failed; continuing without failing the build. Common causes: no network, invalid/placeholder GoogleService-Info.plist credentials, or Firebase project mismatch." + if ! run_upload_symbols "${SPM_UPLOAD_SYMBOLS}" -gsp "${GSP_PATH}" -p ios "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}"; then + echo "warning: FirebaseCrashlytics upload-symbols (SPM) failed or timed out; continuing without failing the build. Common causes: no network, invalid/placeholder GoogleService-Info.plist credentials, or Firebase project mismatch." fi elif [[ -f "${SPM_UPLOAD_SYMBOLS}" ]]; then echo "info: Exec FirebaseCrashlytics upload-symbols from SPM (chmod +x)" chmod +x "${SPM_UPLOAD_SYMBOLS}" - if ! "${SPM_UPLOAD_SYMBOLS}" -gsp "${GSP_PATH}" -p ios "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}"; then - echo "warning: FirebaseCrashlytics upload-symbols (SPM) failed; continuing without failing the build. Common causes: no network, invalid/placeholder GoogleService-Info.plist credentials, or Firebase project mismatch." + if ! run_upload_symbols "${SPM_UPLOAD_SYMBOLS}" -gsp "${GSP_PATH}" -p ios "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}"; then + echo "warning: FirebaseCrashlytics upload-symbols (SPM) failed or timed out; continuing without failing the build. Common causes: no network, invalid/placeholder GoogleService-Info.plist credentials, or Firebase project mismatch." fi else echo "warning: FirebaseCrashlytics run script not found at CocoaPods, framework, or SPM paths. Skipping dSYM upload." diff --git a/test-rn-bare/ios/testrnbare.xcodeproj/project.pbxproj b/test-rn-bare/ios/testrnbare.xcodeproj/project.pbxproj index 0377728a0e..692aca3fe9 100644 --- a/test-rn-bare/ios/testrnbare.xcodeproj/project.pbxproj +++ b/test-rn-bare/ios/testrnbare.xcodeproj/project.pbxproj @@ -622,7 +622,7 @@ repositoryURL = "https://github.com/firebase/firebase-ios-sdk.git"; requirement = { kind = exactVersion; - version = 13.1.0; + version = 13.1.1; }; }; /* End XCRemoteSwiftPackageReference section */ diff --git a/tests/ios/testing.xcodeproj/project.pbxproj b/tests/ios/testing.xcodeproj/project.pbxproj index 4577254d6b..c8fee1378a 100644 --- a/tests/ios/testing.xcodeproj/project.pbxproj +++ b/tests/ios/testing.xcodeproj/project.pbxproj @@ -832,7 +832,7 @@ repositoryURL = "https://github.com/firebase/firebase-ios-sdk.git"; requirement = { kind = exactVersion; - version = 13.1.0; + version = 13.1.1; }; }; /* End XCRemoteSwiftPackageReference section */