Skip to content
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

🔥 [🐛] Database stops working after WIFI off -> WIFI on #8355

Closed
2 of 7 tasks
MorganTrudeau opened this issue Feb 20, 2025 · 2 comments
Closed
2 of 7 tasks

🔥 [🐛] Database stops working after WIFI off -> WIFI on #8355

MorganTrudeau opened this issue Feb 20, 2025 · 2 comments
Labels

Comments

@MorganTrudeau
Copy link

MorganTrudeau commented Feb 20, 2025

Issue

Describe your issue here

I have just upgraded from firebase 20.3.0 to 21.7.4. Now on my iPhone X iOS 16.7 when I turn wifi off then turn it back on both database methods on and once hang indefinitely. I needed to upgrade to 21.7.4 in order to build on xcode 16.2 (are you seeing this requirement as well?). 20.3.0 is working great in production.

This is happening on the dev version of my production react-native(v0.74.5) app. I have also reproduced this on a fresh react-native(v0.77.0) with only firebase/app and firebase/database packages added.

This is happening with Namespaced and Modular queries. Also occurs in debug and release build.

Xcode logs the following after turning back on wifi and making a query:

[[FirebaseDatabase]] 11.8.1 - [FirebaseDatabase][I-RDB083016] Error sending web socket data: Error Domain=NSPOSIXErrorDomain Code=57 "Socket is not connected" UserInfo={NSErrorFailingURLStringKey=wss://s-usc1a-nss-2008.firebaseio.com/.ws?v=5&ns=database-test-5860a-default-rtdb, NSErrorFailingURLKey=wss://s-usc1a-nss-2008.firebaseio.com/.ws?v=5&ns=database-test-5860a-default-rtdb}.

Let me know if you need any more information. Thank you for your attention on this.


Project Files

Javascript

Click To Expand

package.json:

{
  "name": "AwesomeProject",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "lint": "eslint .",
    "start": "react-native start",
    "test": "jest"
  },
  "dependencies": {
    "@react-native-firebase/app": "^21.10.1",
    "@react-native-firebase/database": "^21.10.1",
    "react": "18.3.1",
    "react-native": "0.77.0"
  },
  "devDependencies": {
    "@babel/core": "^7.25.2",
    "@babel/preset-env": "^7.25.3",
    "@babel/runtime": "^7.25.0",
    "@react-native-community/cli": "15.0.1",
    "@react-native-community/cli-platform-android": "15.0.1",
    "@react-native-community/cli-platform-ios": "15.0.1",
    "@react-native/babel-preset": "0.77.0",
    "@react-native/eslint-config": "0.77.0",
    "@react-native/metro-config": "0.77.0",
    "@react-native/typescript-config": "0.77.0",
    "@types/jest": "^29.5.13",
    "@types/react": "^18.2.6",
    "@types/react-test-renderer": "^18.0.0",
    "eslint": "^8.19.0",
    "jest": "^29.6.3",
    "prettier": "2.8.8",
    "react-test-renderer": "18.3.1",
    "typescript": "5.0.4"
  },
  "engines": {
    "node": ">=18"
  }
}

iOS

Click To Expand

ios/Podfile:

  • I'm not using Pods
  • I'm using Pods and my Podfile looks like:
# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
  'require.resolve(
    "react-native/scripts/react_native_pods.rb",
    {paths: [process.argv[1]]},
  )', __dir__]).strip

platform :ios, min_ios_version_supported
prepare_react_native_project!

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
end
$RNFirebaseAsStaticFramework = true

target 'AwesomeProject' do
  config = use_native_modules!

  use_react_native!(
    :path => config[:reactNativePath],
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  post_install do |installer|
    # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false,
      # :ccache_enabled => true
    )
  end
end

AppDelegate.swift:

Note that I have tried this with Objective C AppDelegate.mm

import UIKit
import React
import React_RCTAppDelegate
import ReactAppDependencyProvider
import Firebase

@main
class AppDelegate: RCTAppDelegate {
  override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
    FirebaseApp.configure()
    
    self.moduleName = "AwesomeProject"
    self.dependencyProvider = RCTAppDependencyProvider()

    // You can add your custom initial props in the dictionary below.
    // They will be passed down to the ViewController used by React Native.
    self.initialProps = [:]

    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }

  override func sourceURL(for bridge: RCTBridge) -> URL? {
    self.bundleURL()
  }

  override func bundleURL() -> URL? {
#if DEBUG
    RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
#else
    Bundle.main.url(forResource: "main", withExtension: "jsbundle")
#endif
  }
}


Environment

Click To Expand

react-native info output:

System:
  OS: macOS 14.5
  CPU: (10) x64 Apple M1 Pro
  Memory: 20.25 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.19.0
    path: ~/.nvm/versions/node/v18.19.0/bin/node
  Yarn:
    version: 4.3.1
    path: ~/.nvm/versions/node/v18.19.0/bin/yarn
  npm:
    version: 10.2.3
    path: ~/.nvm/versions/node/v18.19.0/bin/npm
  Watchman:
    version: 2024.12.02.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.2
      - iOS 18.2
      - macOS 15.2
      - tvOS 18.2
      - visionOS 2.2
      - watchOS 11.2
  Android SDK:
    API Levels:
      - "26"
      - "27"
      - "28"
      - "29"
      - "30"
      - "31"
      - "32"
      - "33"
      - "33"
      - "33"
      - "34"
      - "35"
    Build Tools:
      - 28.0.3
      - 29.0.2
      - 29.0.3
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 33.0.0
      - 34.0.0
      - 35.0.0
    System Images:
      - android-27 | Google APIs ARM 64 v8a
      - android-31 | Google APIs ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.23726.103.2422.12816248
  Xcode:
    version: 16.2/16C5032a
Languages:
  Java:
    version: 17.0.12
  Ruby:
    version: 2.7.6
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.1
    wanted: 15.0.1
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.77.0
    wanted: 0.77.0
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true
  • Platform that you're experiencing the issue on:
    • iOS
    • Android
    • iOS but have not tested behavior on Android
    • Android but have not tested behavior on iOS
    • Both
  • react-native-firebase versions
    "@react-native-firebase/app": "^21.10.1",
    "@react-native-firebase/database": "^21.10.1",
  • TypeScript
    "typescript": "5.0.4"


@MorganTrudeau MorganTrudeau changed the title 🔥 Database stops working after WIFI off -> WIFI on 🔥 [🐛] Database stops working after WIFI off -> WIFI on Feb 20, 2025
@mikehardy
Copy link
Collaborator

I believe you will like this PR upstream (check the related issues...) firebase/firebase-ios-sdk#14427

... which will be released the week of Feb 24

This is not something that is in our control unfortunately so I'm going to close this but I encourage you to subscribe to the upstream issues that are of interest and/or the repo releases notification of firebase-ios-sdk if that is of interest. We will adopt that SDK internally and release it almost immediately after it comes out

@MorganTrudeau
Copy link
Author

Ah okay, thanks @mikehardy. Looks like I'll resort to building on xcode 15 for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants