invertase / react-native-firebase

🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.71k stars 2.22k forks source link

🔥[🐛] Firebase cloud function https callable not found #5365

Closed Vadko closed 3 years ago

Vadko commented 3 years ago

Issue

Firebase https callable function not found

I've got an error after cloning project to another pc and setting up environment, firebase callable function fires with NOT FOUND error.

 const login = async ({ phone }) => {
    setLoading(true);
    Keyboard.dismiss();
    try {
      const checkIsRegistered = functions().httpsCallable("isRegistered");
      const isRegistered = (await checkIsRegistered({ phone })).data;
      if (isRegistered) {
        navigation.navigate("ConfirmSms", {
          isNewUser: false,
          phone,
        });
      } else {
        throw {
          message: `There is no user with ${phone} number registered`,
        };
      }
    } catch (error) {
      setLoading(false);
      showMessage({
        message: error.message,
        type: "danger",
      });
    }
  };

I'm 100% sure that this function is fully working because actual app that is deployed on the App Store works well with this function.


Project Files

Javascript

Click To Expand

#### `package.json`: ```json { "name": "skye2", "version": "0.0.1", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "start": "react-native start", "test": "jest", "lint": "eslint .", "build:ios": "react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios'" }, "dependencies": { "@miblanchard/react-native-slider": "^1.5.0", "@react-native-async-storage/async-storage": "^1.14.1", "@react-native-community/datetimepicker": "^3.2.0", "@react-native-community/masked-view": "^0.1.10", "@react-native-firebase/analytics": "^10.8.1", "@react-native-firebase/app": "^10.8.1", "@react-native-firebase/auth": "^10.8.1", "@react-native-firebase/firestore": "^10.8.1", "@react-native-firebase/functions": "^10.8.1", "@react-native-firebase/messaging": "^10.8.1", "@react-native-picker/picker": "^1.9.11", "@react-navigation/bottom-tabs": "^5.11.8", "@react-navigation/native": "^5.9.3", "@react-navigation/stack": "^5.14.3", "@typescript-eslint/eslint-plugin": "^4.16.0", "@typescript-eslint/parser": "^4.16.0", "dayjs": "^1.10.4", "eslint-config-universe": "^7.0.1", "lodash": "^4.17.21", "metro-config": "^0.65.2", "react": "16.13.1", "react-hook-form": "^6.15.4", "react-native": "0.63.4", "react-native-confirmation-code-field": "^6.5.1", "react-native-fbsdk": "^3.0.0", "react-native-flash-message": "^0.1.23", "react-native-gesture-handler": "^1.10.3", "react-native-iap": "^5.2.14", "react-native-intercom": "^19.0.0", "react-native-keyboard-avoiding-scroll-view": "^1.0.1", "react-native-keyboard-aware-scroll-view": "^0.9.3", "react-native-localize": "^2.0.3", "react-native-modal-datetime-picker": "^9.2.0", "react-native-picker-select": "^8.0.4", "react-native-reanimated": "^1.13.2", "react-native-responsive-screen": "^1.4.2", "react-native-safe-area-context": "^3.1.9", "react-native-screens": "^2.18.1", "react-native-snap-carousel": "^3.9.1", "react-native-svg": "^12.1.0", "react-native-text-input-mask": "^2.0.1", "react-native-toast-message": "^1.4.7", "react-native-tracking-transparency": "^0.1.0", "react-native-ux-cam": "^5.3.2", "react-native-vector-icons": "^8.1.0", "react-redux": "^7.2.2", "react-redux-firebase": "^3.10.0", "react-spring": "^8.0.27", "redux": "^4.0.5", "redux-firestore": "^0.15.0", "redux-persist": "^6.0.0", "typescript": "^4.2.2" }, "devDependencies": { "@babel/core": "^7.8.4", "@babel/runtime": "^7.13.9", "@react-native-community/eslint-config": "^1.1.0", "babel-jest": "^25.1.0", "eslint": "^6.5.1", "jest": "^25.1.0", "metro-react-native-babel-preset": "^0.59.0", "react-native-svg-transformer": "^0.14.3", "react-test-renderer": "16.13.1" }, "eslintConfig": { "extends": "universe/native" }, "jest": { "preset": "react-native" } } ``` #### `firebase.json` for react-native-firebase v6: ```json # N/A ```

iOS

Click To Expand

#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby require_relative '../node_modules/react-native/scripts/react_native_pods' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' platform :ios, '10.0' target 'skye2' do config = use_native_modules! use_react_native!(:path => config["reactNativePath"]) pod 'RNInputMask', :path => '../node_modules/react-native-text-input-mask/ios/InputMask' pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons' target 'skye2Tests' do inherit! :complete # Pods for testing end # Enables Flipper. # # Note that if you have use_frameworks! enabled, Flipper will not work and # you should disable these next few lines. # use_flipper! end target 'skye2-tvOS' do # Pods for skye2-tvOS target 'skye2-tvOSTests' do inherit! :search_paths # Pods for testing end end ``` #### `AppDelegate.m`: ```objc #import "AppDelegate.h" #import #import #import #import #import #import "Intercom/intercom.h" #ifdef FB_SONARKIT_ENABLED #import #import #import #import #import #import static void InitializeFlipper(UIApplication *application) { FlipperClient *client = [FlipperClient sharedClient]; SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults]; [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]]; [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]]; [client addPlugin:[FlipperKitReactPlugin new]]; [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]]; [client start]; } #endif @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { #ifdef FB_SONARKIT_ENABLED InitializeFlipper(application); #endif RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"skye2" initialProperties:nil]; rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; if ([FIRApp defaultApp] == nil) { [FIRApp configure]; } [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions]; self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; UIViewController *rootViewController = [UIViewController new]; rootViewController.view = rootView; self.window.rootViewController = rootViewController; [self.window makeKeyAndVisible]; return YES; } - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { // Intercom [Intercom setDeviceToken:deviceToken]; } - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(nonnull NSDictionary *)options { [[FBSDKApplicationDelegate sharedInstance] application:application openURL:url options:options]; return YES; } - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { #if DEBUG return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; #else return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; #endif } @end ```


Click To Expand

**`react-native info` output:** ``` OUTPUT GOES HERE ``` - **Platform that you're experiencing the issue on**: - [ ] iOS - [ ] Android - [x] **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:** - 10.8.1 - **`Firebase` module(s) you're using that has the issue:** - functions - **Are you using `TypeScript`?** - no

Vadko commented 3 years ago

Problem was referred to the plist file