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

[🐛] iOS messaging().getToken() error "Too many server requests" #6231

Closed JakeGilesPhillips closed 2 years ago

JakeGilesPhillips commented 2 years ago

Issue

On iOS, calling messaging().getToken() returns only an error: [Error: [messaging/unknown] The operation couldn’t be completed. Too many server requests.]

There's no issues receiving push notifications this same way on Android.


Project Files

Javascript

Click To Expand

#### `package.json`: ```json { "name": "Dropless", "version": "0.0.1", "private": true, "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start", "deploy": "scripts/deploy.sh", "build": "scripts/build.sh", "package": "scripts/package.sh", "release": "scripts/android-release.sh", "generate-envs": "scripts/generate-env-files.sh", "test": "jest --config ./jest.config.js", "clean": "rm -rf /tmp/metro-bundler-cache-* && watchman watch-del-all", "clean:ios": "cd ios && rm -rf build && cd .. && rm -rf ~/Library/Developer/Xcode/DerivedData/*", "clean:android": "cd android && ./gradlew clean && cd ..", "clean:packages": "rm -rf node_modules && yarn install && cd ios && rm -rf Pods && pod install && cd ..", "clean:test": "jest --clearCache" }, "dependencies": { "@aws-sdk/client-sqs": "3.31.0", "@firebase/auth": "0.16.6", "@firebase/firestore": "2.3.2", "@fortawesome/fontawesome-svg-core": "1.2.34", "@fortawesome/pro-light-svg-icons": "5.15.2", "@fortawesome/pro-regular-svg-icons": "5.15.2", "@fortawesome/pro-solid-svg-icons": "5.15.2", "@fortawesome/react-native-fontawesome": "0.2.7", "@invertase/react-native-apple-authentication": "2.1.1", "@react-native-async-storage/async-storage": "1.13.2", "@react-native-clipboard/clipboard": "1.8.4", "@react-native-community/blur": "3.6.0", "@react-native-community/cameraroll": "4.0.2", "@react-native-community/checkbox": "0.5.8", "@react-native-community/masked-view": "^0.1.10", "@react-native-community/netinfo": "^5.9.6", "@react-native-community/segmented-control": "2.2.2", "@react-native-cookies/cookies": "6.0.11", "@react-native-firebase/analytics": "14.9.1", "@react-native-firebase/app": "14.9.1", "@react-native-firebase/crashlytics": "14.9.1", "@react-native-firebase/messaging": "14.9.1", "@react-native-google-signin/google-signin": "7.0.3", "@react-native-picker/picker": "2.1.0", "@react-navigation/bottom-tabs": "5.11.2", "@react-navigation/native": "5.8.10", "@react-navigation/stack": "5.12.8", "@storybook/addon-actions": "^5.3", "@storybook/addon-knobs": "^5.3", "@storybook/addon-links": "^5.3", "@storybook/addon-ondevice-actions": "^5.3.23", "@storybook/addon-ondevice-knobs": "^5.3.25", "@storybook/react-native": "^5.3.25", "@stripe/stripe-react-native": "0.5.0", "@types/node": "15.6.1", "@types/react-native-version-check": "3.4.1", "axios": "^0.19.2", "cancelable-promise": "4.2.1", "date-fns": "^2.13.0", "firebase": "8.6.3", "geolib": "3.3.1", "lodash": "4.17.21", "lodash.flatten": "4.4.0", "lodash.isnumber": "^3.0.3", "lodash.isundefined": "3.0.1", "lodash.merge": "4.6.2", "lottie-ios": "3.2.3", "lottie-react-native": "5.0.1", "mobx": "^5.15.4", "mobx-react-lite": "^2.0.6", "moment": "2.29.1", "patch-package": "6.4.7", "postinstall-postinstall": "2.1.0", "prop-types": "15.7.2", "qs": "^6.9.4", "react": "17.0.2", "react-native": "0.67.4", "react-native-anchor-carousel": "4.0.1", "react-native-animatable": "^1.3.3", "react-native-blob-util": "0.13.16", "react-native-bootsplash": "4.1.3", "react-native-calendars": "https://github.com/dropless/rn-dropless-calendars.git", "react-native-camera": "3.42.0", "react-native-collapsible": "1.6.0", "react-native-config": "1.4.1", "react-native-confirmation-code-field": "7.1.0", "react-native-dialog": "9.1.0", "react-native-drawer": "2.5.1", "react-native-face-pile": "1.9.0", "react-native-fbsdk-next": "6.2.0", "react-native-fs": "2.18.0", "react-native-geolocation-service": "^5.0.0", "react-native-gesture-handler": "^1.6.1", "react-native-get-random-values": "^1.4.0", "react-native-image-resizer": "1.4.5", "react-native-image-viewing": "^0.2.0", "react-native-inappbrowser-reborn": "3.5.1", "react-native-keyboard-accessory": "0.1.16", "react-native-keyboard-aware-scroll-view": "0.9.5", "react-native-linear-gradient": "2.5.6", "react-native-maps": "0.30.1", "react-native-markdown-display": "6.1.6", "react-native-modal": "12.0.2", "react-native-pages": "0.9.0", "react-native-permissions": "3.2.0", "react-native-reanimated": "2.5.0", "react-native-safe-area-context": "^1.0.0", "react-native-screens": "^2.7.0", "react-native-skeleton-content-nonexpo": "1.0.13", "react-native-snap-carousel": "^3.9.1", "react-native-spinkit": "^1.5.0", "react-native-status-bar-height": "2.6.0", "react-native-storybook-loader": "2.0.4", "react-native-svg": "12.3.0", "react-native-version-check": "3.4.2", "react-native-version-number": "0.3.6", "react-native-webview": "11.2.2", "react-native-zendesk-chat": "0.4.1", "rn-faded-scrollview": "1.0.10", "string-to-color": "2.2.2", "throttle-debounce": "^2.1.0", "uuid": "^8.1.0" }, "devDependencies": { "@babel/core": "^7.9.0", "@babel/runtime": "^7.9.2", "@react-native-community/eslint-config": "1.1.0", "@storybook/react-native-server": "^5.3.23", "@testing-library/jest-native": "3.4.3", "@testing-library/react-native": "7.2.0", "@types/jest": "^24.0.25", "@types/lodash.flatten": "4.4.6", "@types/lodash.isnumber": "3.0.6", "@types/lodash.isundefined": "3.0.6", "@types/lodash.merge": "4.6.6", "@types/qs": "6.9.3", "@types/react-native": "^0.64.12", "@types/react-native-calendars": "1.505.0", "@types/react-native-fbsdk": "3.0.0", "@types/react-native-snap-carousel": "3.8.2", "@types/react-test-renderer": "16.9.2", "@types/throttle-debounce": "2.1.0", "@types/uuid": "8.0.0", "@typescript-eslint/eslint-plugin": "^2.27.0", "@typescript-eslint/parser": "^2.27.0", "babel-jest": "25.1.0", "babel-loader": "8.2.2", "babel-plugin-inline-import": "3.0.0", "babel-plugin-module-resolver": "^4.0.0", "eslint": "^6.8.0", "eslint-config-airbnb": "^18.0.1", "eslint-config-airbnb-base": "^14.0.0", "eslint-config-prettier": "^6.11.0", "eslint-import-resolver-babel-module": "^5.1.0", "eslint-plugin-import": "^2.20.1", "eslint-plugin-jsx-a11y": "^6.2.3", "eslint-plugin-react": "^7.17.0", "eslint-plugin-react-hooks": "^1.7.0", "eslint-plugin-react-native": "^3.8.1", "jest": "25.1.0", "jetifier": "1.6.8", "metro-react-native-babel-preset": "^0.66.2", "prettier": "^2.0.4", "react-dom": "16.13.1", "react-native-storybook-loader": "2.0.4", "react-test-renderer": "17.0.2", "ts-jest": "25.1.0", "typescript": "^3.8.3" }, "jest": { "preset": "react-native", "moduleFileExtensions": [ "ts", "tsx", "js", "jsx", "json", "node" ] }, "config": { "react-native-storybook-loader": { "searchDir": [ "./storybook" ], "pattern": "**/*.stories.js" } } } ``` #### `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 platform :ios, '11.0' require_relative '../node_modules/react-native/scripts/react_native_pods' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' ENV['SWIFT_VERSION'] = '5.5' target 'Dropless' do # Pods for Dropless config = use_native_modules! use_react_native!(:path => config["reactNativePath"], :hermes_enabled => true) permissions_path = '../node_modules/react-native-permissions/ios' pod 'ZendeskChatSDK' pod 'react-native-google-maps', :path => '../node_modules/react-native-maps' pod 'GoogleMaps' pod 'Google-Maps-iOS-Utils' pod 'Permission-Camera', :path => "#{permissions_path}/Camera" pod 'Permission-LocationAccuracy', :path => "#{permissions_path}/LocationAccuracy" pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways" pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse" pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications" pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary" pod 'Permission-PhotoLibraryAddOnly', :path => "#{permissions_path}/PhotoLibraryAddOnly" # Detect AppCenter CI build IS_CI = ENV['APPCENTER_BUILD_ID'] # Use flipper if not IS_CI use_flipper!() end # Post install post_install do |installer| if not IS_CI react_native_post_install(installer) __apply_Xcode_12_5_M1_post_install_workaround(installer) end end end target 'DroplessTests' do inherit! :complete # Pods for Dropless testing end target 'Dropless-tvOS' do # Pods for Dropless-tvOS end target 'Dropless-tvOSTests' do inherit! :search_paths # Pods for Dropless-tvOS testing end ``` #### `AppDelegate.m`: ```objc #import "AppDelegate.h" #import #import #import #import #import #import #import "ReactNativeConfig.h" #import #import #import @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { NSString *GMapsKey = [ReactNativeConfig envFor:@"GOOGLE_API_KEY"]; //Make sure this is the first call of the method [GMSServices provideAPIKey:GMapsKey]; // add this line using the api key obtained from Google Console //Firebase setup if ([FIRApp defaultApp] == nil) { [FIRApp configure]; } RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"Dropless" initialProperties:nil]; if (@available(iOS 13.0, *)) { rootView.backgroundColor = [UIColor systemBackgroundColor]; } else { rootView.backgroundColor = [UIColor whiteColor]; } self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; UIViewController *rootViewController = [UIViewController new]; rootViewController.view = rootView; self.window.rootViewController = rootViewController; [self.window makeKeyAndVisible]; [RNBootSplash initWithStoryboard:@"BootSplash" rootView:rootView]; [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions]; return YES; } - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { #if DEBUG return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; #else return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; #endif } #pragma mark - Handling URLs - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options { return [RCTLinkingManager application:app openURL:url options:options]; } @end ```


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`: ```groovy // N/A ``` #### `android/app/build.gradle`: ```groovy // N/A ``` #### `android/settings.gradle`: ```groovy // N/A ``` #### `MainApplication.java`: ```java // N/A ``` #### `AndroidManifest.xml`: ```xml ```


Environment

Click To Expand

**`react-native info` output:** ``` System: OS: macOS 12.3.1 CPU: (12) x64 Intel(R) Core(TM) i5-10500 CPU @ 3.10GHz Memory: 157.12 MB / 32.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 16.13.0 - /usr/local/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 8.1.0 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5 Android SDK: Not Found IDEs: Android Studio: 2021.1 AI-211.7628.21.2111.8092744 Xcode: 13.3/13E113 - /usr/bin/xcodebuild Languages: Java: 11.0.14 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: 0.67.4 => 0.67.4 react-native-macos: Not Found npmGlobalPackages: *react-native*: Not Found ``` - **Platform that you're experiencing the issue on**: - [x] 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:** - `14.9.1` - **`Firebase` module(s) you're using that has the issue:** - `react-native-firebase/messaging` - **Are you using `TypeScript`?** - `Y` & `3.8.3`


mikehardy commented 2 years ago

Hi there! Unfortunately I'm going to close this as a non-actionable duplicate of quite a few including #5873 - my best analysis of it is this comment https://github.com/invertase/react-native-firebase/issues/5873#issuecomment-975164699

droplessjake commented 2 years ago

Hi there! Unfortunately I'm going to close this as a non-actionable duplicate of quite a few including #5873 - my best analysis of it is this comment #5873 (comment)

Hi Mike, thanks for your reply (sorry swapped github accounts from the one I posted with), I did notice after submitting my own error a lot of similar ones, and your responses in them, I will take a look through them all now and hopefully find something that helps us here. Apologies for the duplicate bug report

NIDHINgl commented 2 years ago

@JakeGilesPhillips hey, still the bug is there, did you able to fix ?