Skip to content

[🐛] 🔥 This method is deprecated (accessing a parameter) #8768

@wneel

Description

@wneel

Issue

Hi :)

It's not a major problem, I just think it comes from the modular catcher catching a .toJSON as a modular function ? I can look at it the next week if you want!

When using onAuthStateChanged and when accessing the callback nextOrObserver parameter i get this issue:

This method is deprecated (as well as all React Native Firebase namespaced API) and will be removed in the next major release as part of move to match Firebase Web modular SDK API. Please see migration guide for more details: https://rnfirebase.io/migrating-to-v22. Method called was `toJSON`

Here is a minimal setup to reproduce the error :

import { useEffect } from 'react';
import { onAuthStateChanged } from '@react-native-firebase/auth';

import type { FirebaseAuthTypes} from '@react-native-firebase/auth';

...

  useEffect(() => {
    const unsubscribe = onAuthStateChanged(auth, async (authUser: FirebaseAuthTypes.User | null) => {
    	console.i("authUser: ", authUser); // <-- here is the issue coming from, when commenting the line it diseappear!
    });
    
    return () => unsubscribe();
  }, []);

...
// console.i is just :
// I mention it because in the stack trace the error is located from my custom console class at the end
console.i = (...args) => console.log("\x1b[34m[INFO]\x1b[0m", ...args);
Image

Project Files

Javascript

Click To Expand

package.json:

{
	"dependencies": {
		"@notifee/react-native": "^9.1.8",
		"@quidone/react-native-wheel-picker": "^1.6.1",
		"@react-native-async-storage/async-storage": "^2.2.0",
		"@react-native-community/geolocation": "^3.4.0",
		"@react-native-firebase/analytics": "^23.5.0",
		"@react-native-firebase/app": "^23.5.0",
		"@react-native-firebase/app-check": "^23.5.0",
		"@react-native-firebase/auth": "^23.5.0",
		"@react-native-firebase/crashlytics": "^23.5.0",
		"@react-native-firebase/firestore": "^23.5.0",
		"@react-native-firebase/messaging": "^23.5.0",
		"@react-native-firebase/storage": "^23.5.0",
		"@react-native-masked-view/masked-view": "^0.3.2",
		"@react-navigation/bottom-tabs": "^7.8.6",
		"@react-navigation/native": "^7.1.21",
		"@react-navigation/stack": "^7.6.5",
		"fuse.js": "^7.1.0",
		"geofire-common": "^6.0.0",
		"react": "19.1.1",
		"react-native": "^0.82.1",
		"react-native-blob-util": "^0.23.2",
		"react-native-date-picker": "^5.0.12",
		"react-native-edge-to-edge": "^1.7.0",
		"react-native-gesture-handler": "^2.29.1",
		"react-native-get-device-locale": "^0.3.0",
		"react-native-image-crop-picker": "^0.42.0",
		"react-native-maps": "^1.26.18",
		"react-native-reanimated": "^4.1.5",
		"react-native-safe-area-context": "^5.6.2",
		"react-native-screens": "^4.11.1",
		"react-native-share": "^12.2.1",
		"react-native-shared-group-preferences": "^1.1.24",
		"react-native-svg": "^15.15.0",
		"react-native-view-shot": "^4.0.3",
		"react-native-worklets": "^0.6.1"
	},
	"devDependencies": {
		"@babel/core": "^7.28.5",
		"@babel/preset-env": "^7.28.5",
		"@babel/preset-typescript": "^7.28.5",
		"@babel/runtime": "^7.28.4",
		"@firebase/rules-unit-testing": "^4.0.1",
		"@react-native-community/cli": "^20.0.2",
		"@react-native-community/cli-platform-android": "^20.0.2",
		"@react-native-community/cli-platform-ios": "^20.0.2",
		"@react-native-community/cli-server-api": "20.0.2",
		"@react-native/babel-preset": "^0.82.1",
		"@react-native/metro-config": "^0.82.1",
		"@react-native/typescript-config": "^0.82.1",
		"@rnx-kit/align-deps": "^3.3.2",
		"@types/jest": "^29.5.14",
		"@types/node": "^22.14.1",
		"@types/react": "^19.1.1",
		"@types/react-test-renderer": "^19.1.0",
		"@typescript-eslint/eslint-plugin": "^8.47.0",
		"@typescript-eslint/parser": "^8.47.0",
		"babel-jest": "^29.7.0",
		"babel-plugin-module-resolver": "^5.0.2",
		"babel-plugin-transform-remove-console": "^6.9.4",
		"detox": "^20.45.1",
		"eslint": "^9.39.1",
		"eslint-config-prettier": "^10.1.8",
		"eslint-plugin-prettier": "^5.5.4",
		"eslint-plugin-react": "^7.37.5",
		"eslint-plugin-react-native": "^5.0.0",
		"eslint-plugin-simple-import-sort": "^12.1.1",
		"firebase-admin": "^13.6.0",
		"globals": "^16.5.0",
		"jest": "^29.2.1",
		"jiti": "^2.6.1",
		"prettier": "^3.6.2",
		"react-native-dotenv": "^3.4.11",
		"react-test-renderer": "19.1.1",
		"ts-jest": "^29.4.5",
		"typescript": "^5.8.3",
		"typescript-eslint": "^8.47.0"
	},
	"engines": {
		"node": ">=20"
	},
}

firebase.json for react-native-firebase v6:

{
	"emulators": {
		"auth": {
			"port": 9099
		},
		"firestore": {
			"port": 8080
		},
		"storage": {
			"port": 9199
		},
		"functions": {
			"port": 5001
		},
		"ui": {
			"enabled": true
		},
		"singleProjectMode": true,
		"apphosting": {
			"port": 5002,
			"rootDirectory": "blog",
			"startCommand": "npx next dev"
		},
		"hosting": {
			"port": 5000
		}
	},
	"react-native": {
		"crashlytics_debug_enabled": true,
		"crashlytics_auto_collection_enabled": true,
		"crashlytics_disable_auto_disabler": true,
		"crashlytics_is_error_generation_on_js_crash_enabled": true,
		"crashlytics_javascript_exception_handler_chaining_enabled": false
	}
}

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

target 'myApp' do
  config = use_native_modules!
	use_frameworks! :linkage => :static
	$RNFirebaseAsStaticFramework = true
	$RNFirebaseAnalyticsWithoutAdIdSupport=true
  use_react_native!(
    :path => config[:reactNativePath],
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )
	pod 'GoogleUtilities'

  post_install do |installer|
		installer.pods_project.targets.each do |target|
			target.build_configurations.each do |config|
				config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
			end
		end #https://github.com/invertase/react-native-firebase/issues/7127
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false,
			# :ccache_enabled => true
    )
  end
end

target 'myAppExtension' do
  use_frameworks! :linkage => :static
	pod 'GoogleUtilities', :modular_headers => true
  pod 'FirebaseCore', :modular_headers => true
  pod 'FirebaseAuth', :modular_headers => true
  pod 'FirebaseFirestore', :modular_headers => true
  pod 'FirebaseAppCheck', :modular_headers => true
end

AppDelegate.swift:

import UIKit
import RNFBAppCheck
import FirebaseCore
import React
import React_RCTAppDelegate
import ReactAppDependencyProvider

@main
class AppDelegate: UIResponder, UIApplicationDelegate {
	var window: UIWindow?

  var reactNativeDelegate: ReactNativeDelegate?
  var reactNativeFactory: RCTReactNativeFactory?

  func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
  ) -> Bool {
		RNFBAppCheckModule.sharedInstance()
		FirebaseApp.configure()
    let delegate = ReactNativeDelegate()
    let factory = RCTReactNativeFactory(delegate: delegate)
    delegate.dependencyProvider = RCTAppDependencyProvider()

    reactNativeDelegate = delegate
    reactNativeFactory = factory

    window = UIWindow(frame: UIScreen.main.bounds)

    factory.startReactNative(
      withModuleName: "myApp",
      in: window,
      launchOptions: launchOptions
    )

    return true
  }
}

class ReactNativeDelegate: RCTDefaultReactNativeFactoryDelegate {
  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
  }
}


Android

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 -->


Environment

Click To Expand

react-native info output:

 OUTPUT GOES HERE
  • 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 version you're using that has this issue:
    • ^23.5.0
  • Firebase module(s) you're using that has the issue:
    • @react-native-firebase/auth
  • Are you using TypeScript?
    • Y & ^5.8.3


Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions