Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/faqs-and-tips.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
4 changes: 2 additions & 2 deletions docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions docs/ios-spm.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:

Expand Down
2 changes: 1 addition & 1 deletion packages/app/firebase_spm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#
Expand Down
2 changes: 1 addition & 1 deletion packages/app/ios/RNFBFirebase/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down
2 changes: 1 addition & 1 deletion packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
28 changes: 27 additions & 1 deletion packages/crashlytics/__tests__/ios_config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
`;
Expand Down Expand Up @@ -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<string, string> = {}) {
return spawnSync('bash', [SCRIPT_PATH], {
cwd: projectDir,
encoding: 'utf8',
env: {
PATH: process.env.PATH,
...extraEnv,
PROJECT_DIR: projectDir,
TARGET_NAME: targetName,
BUILD_DIR: buildDir,
Expand Down Expand Up @@ -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 () {
Expand Down
18 changes: 14 additions & 4 deletions packages/crashlytics/ios_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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."
Expand Down
2 changes: 1 addition & 1 deletion test-rn-bare/ios/testrnbare.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion tests/ios/testing.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
Loading