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.66k stars 2.21k forks source link

[🐛] iOS : Could not connect to the server & Bad URL #7112

Closed kukuandroid closed 1 year ago

kukuandroid commented 1 year ago

Issue

Some of iOS devices facing weird issue while generating token using await messaging().getToken() Error list :

This issues happened on production build and i can't reproduce it on development. Please help


Project Files

Javascript

Click To Expand

#### `package.json`: ```json { "name": "mae", "version": "0.7.6", "private": true, "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start", "start:metro": "react-native start --port=8082", "test": "jest", "test:e2e:build": "detox build --configuration ios.sim.debug", "test:e2e:test": "detox test --configuration ios.sim.debug", "lint": "sh ./lint.sh", "prettier": "pretty-quick --staged", "postinstall": "npm run patch && npm run jettify && rm -rf natives/**/node_modules", "jettify": "jetifier", "patch": "patch-package", "run:ios:sit:debug": "react-native run-ios --scheme 'M2ULife SIT' --simulator='iPhone 12 Pro Max'", "run:ios:sit:release": "react-native run-ios --configuration Release --scheme 'M2ULife SIT' --simulator='iPhone 12 Pro Max'", "run:ios:uat:debug": "react-native run-ios --scheme 'M2ULife UAT' --simulator='iPhone 12 Pro Max'", "run:ios:dev:debug": "react-native run-ios --scheme 'M2ULife Development' --simulator='iPhone 12 Pro Max'", "run:ios:prod:debug": "react-native run-ios --scheme 'M2ULife Production' --simulator='iPhone 12 Pro Max'", "run:android:dev:debug": "react-native run-android --variant=devDebug --appId=com.maybank2u.life.dev", "run:android:dev:release": "react-native run-android --variant=devRelease --appId=com.maybank2u.life.dev", "run:android:sit:debug": "react-native run-android --variant=sitDebug --appId=com.maybank2u.life.sit", "run:android:sit:release": "react-native run-android --variant=sitRelease --appId=com.maybank2u.life.sit", "run:android:uat:debug": "react-native run-android --variant=uatDebug --appId=com.maybank2u.life.uat", "run:android:uat:release": "react-native run-android --variant=uatRelease --appId=com.maybank2u.life.uat", "run:android:ntt:debug": "react-native run-android --variant=nttDebug --appId=com.maybank2u.life.ntt", "run:android:ntt:release": "react-native run-android --variant=nttRelease --appId=com.maybank2u.life.ntt", "run:android:kldc:debug": "react-native run-android --variant=kldcDebug --appId=com.maybank2u.life.kldc", "run:android:kldc:release": "react-native run-android --variant=kldcRelease --appId=com.maybank2u.life.kldc", "run:android:cind:debug": "react-native run-android --variant=cindDebug --appId=com.maybank2u.life.cind", "run:android:cind:release": "react-native run-android --variant=cindRelease --appId=com.maybank2u.life.cind", "run:android:prod:debug": "react-native run-android --variant=prodDebug --appId=com.maybank2u.life", "run:android:prod:release": "react-native run-android --variant=prodRelease --appId=com.maybank2u.life", "run:android:stg:debug": "react-native run-android --variant=stgDebug --appId=com.maybank2u.stg", "run:android:stg:release": "react-native run-android --variant=stgRelease --appId=com.maybank2u.stg", "run:android:huaweisit:debug": "react-native run-android --variant=huaweisitDebug --appId=com.maybank2u.life.huawei.sit", "run:android:huaweisit:release": "react-native run-android --variant=huaweisitRelease --appId=com.maybank2u.life.huawei.sit", "run:android:huaweiuat:debug": "react-native run-android --variant=huaweiuatDebug --appId=com.maybank2u.life.huawei.uat", "run:android:huaweiuat:release": "react-native run-android --variant=huaweiuatRelease --appId=com.maybank2u.life.huawei.uat", "run:android:huaweistg:debug": "react-native run-android --variant=huaweistgDebug --appId=com.maybank2u.life.huawei.stg", "run:android:huaweistg:release": "react-native run-android --variant=huaweistgRelease --appId=com.maybank2u.life.huawei.stg", "run:android:huaweiprod:debug": "react-native run-android --variant=huaweiprodDebug --appId=com.maybank2u.life.huawei", "run:android:huaweiprod:release": "react-native run-android --variant=huaweiprodRelease --appId=com.maybank2u.life.huawei", "bundle:android:prod": "cd android && ./gradlew bundleProd && cd ..", "bundle:android:huaweiprod": "cd android && ./gradlew bundleProd && cd ..", "clean:android": "cd android && ./gradlew clean && cd ..", "reactotron:reverse": "adb reverse tcp:9090 tcp:9090", "pod:install": "cd ios && pod update && pod install --verbose && cd ..", "prepare": "husky install .husky", "ios:bundle": "react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios" }, "dependencies": { "@bugsnag/react-native": "^7.4.0", "@hmscore/react-native-hms-analytics": "^5.3.1-300", "@hmscore/react-native-hms-availability": "^5.2.0-300", "@hmscore/react-native-hms-location": "^5.1.0-303", "@hmscore/react-native-hms-push": "^6.5.0-300", "@notifee/react-native": "^5.2.2", "@popmotion/popcorn": "^0.4.4", "@react-native-agconnect/applinking": "^1.2.0", "@react-native-agconnect/crash": "^1.2.0", "@react-native-community/art": "^1.2.0", "@react-native-community/async-storage": "^1.12.0", "@react-native-community/blur": "^3.6.0", "@react-native-community/cameraroll": "^4.0.2", "@react-native-community/clipboard": "^1.5.1", "@react-native-community/masked-view": "^0.1.10", "@react-native-community/netinfo": "^5.9.7", "@react-native-firebase/analytics": "^17.0.0", "@react-native-firebase/app": "^17.0.0", "@react-native-firebase/crashlytics": "^17.0.0", "@react-native-firebase/dynamic-links": "^17.0.0", "@react-native-firebase/messaging": "^17.0.0", "@react-native-firebase/perf": "^17.0.0", "@react-navigation/bottom-tabs": "^5.9.1", "@react-navigation/native": "^5.7.5", "@react-navigation/stack": "^5.9.2", "@reduxjs/toolkit": "^1.8.3", "@sentry/react-native": "^2.6.0", "@skele/components": "^1.0.0-alpha.40", "accordion-collapse-react-native": "^1.1.0", "axios": "^0.21.1", "cachee": "https://github.com/irfanrosly/react-native-fast-image#next", "compare-versions": "^3.6.0", "d3-shape": "^2.0.0", "jail-monkey": "^2.3.3", "lodash": "^4.17.20", "lottie-react-native": "^4.0.2", "moment": "^2.29.0", "numeral": "^2.0.6", "prop-types": "^15.7.2", "react": "16.13.1", "react-native": "0.63.3", "react-native-actionsheet": "^2.4.2", "react-native-android-open-settings": "^1.3.0", "react-native-animatable": "^1.3.3", "react-native-background-timer": "^2.4.1", "react-native-barcode-builder": "^2.0.0", "react-native-biometrics": "^2.1.4", "react-native-bootsplash": "^2.2.6", "react-native-camera": "^4.2.1", "react-native-card-flip": "^1.0.7", "react-native-chart-kit": "^6.12.0", "react-native-collapsible": "^1.6.0", "react-native-config": "1.4.3", "react-native-contacts": "^5.2.8", "react-native-countdown-circle": "^3.0.1", "react-native-countdown-component": "^2.7.1", "react-native-device-info": "^9.0.2", "react-native-document-picker": "^6.0.4", "react-native-draggable-flatlist": "^3.1.2", "react-native-ekyc": "file:natives/react-native-ekyc", "react-native-exit-app": "^1.1.0", "react-native-fbsdk": "^3.0.0", "react-native-flash-message": "^0.1.16", "react-native-flipper": "^0.75.1", "react-native-fs": "^2.16.6", "react-native-geocoder": "^0.5.0", "react-native-geolocation-service": "^5.2.0", "react-native-gesture-handler": "^1.8.0", "react-native-haptic": "^1.0.1", "react-native-html-to-pdf": "^0.8.0", "react-native-image-base64": "^0.1.4", "react-native-image-crop-picker": "^0.37.2", "react-native-image-zoom-viewer": "^3.0.1", "react-native-keyboard-aware-scroll-view": "^0.9.2", "react-native-libsodium-sdk": "file:natives/react-native-libsodium-sdk", "react-native-linear-gradient": "^2.5.6", "react-native-mmkv": "2.5.1", "react-native-modal": "^11.5.6", "react-native-network-logger": "^1.8.1", "react-native-pager-view": "^5.4.0", "react-native-passkit-wallet": "file:natives/react-native-passkit-wallet", "react-native-payments": "^0.8.4", "react-native-permissions": "^2.2.2", "react-native-phone-call": "^1.0.9", "react-native-picker-scrollview": "^1.0.1", "react-native-progress": "^4.1.2", "react-native-qrcode-image": "^0.2.8", "react-native-qrcode-scanner": "^1.4.1", "react-native-reanimated": "^1.13.1", "react-native-render-html": "^4.2.4", "react-native-responsive-screen": "^1.4.2", "react-native-rootbeer": "0.0.2", "react-native-rsa-sdk": "file:natives/react-native-rsa-sdk", "react-native-safe-area-context": "^3.1.8", "react-native-safety-net": "file:natives/react-native-safety-net", "react-native-screens": "^2.11.0", "react-native-secure-storage": "^0.1.2", "react-native-select-contact": "^1.5.0", "react-native-set-soft-input-mode": "^1.1.0", "react-native-share": "^8.0.0", "react-native-shimmer-placeholder": "^2.0.6", "react-native-simple-dialogs": "^1.3.0", "react-native-slider": "^0.11.0", "react-native-sound-player": "^0.10.8", "react-native-svg": "^12.1.0", "react-native-svg-charts": "^5.4.0", "react-native-swipe-list-view": "^3.2.4", "react-native-swiper": "^1.6.0", "react-native-swiper-flatlist": "^2.0.4", "react-native-switch-selector": "^2.0.6", "react-native-switch-toggle": "^2.0.0", "react-native-system-setting": "^1.7.6", "react-native-tab-view": "^3.1.1", "react-native-view-pdf": "^0.11.0", "react-native-view-shot": "^3.1.2", "react-native-webview": "^10.9.2", "react-redux": "^7.2.6", "redux-thunk": "^2.4.1", "rn-fetch-blob": "^0.12.0", "rn-qr-generator": "1.1.4", "tweetnacl": "^1.0.3", "tweetnacl-util": "^0.15.1", "react-native-aes-gcm-crypto": "^0.2.2", "react-native-get-random-values": "^1.8.0" }, "devDependencies": { "@babel/core": "^7.11.6", "@babel/runtime": "^7.11.2", "@bugsnag/source-maps": "^2.0.0", "@react-native-community/eslint-config": "^1.1.0", "@trivago/prettier-plugin-sort-imports": "^2.0.2", "babel-jest": "^25.1.0", "babel-plugin-ignite-ignore-reactotron": "^0.3.0", "babel-plugin-module-resolver": "^4.0.0", "babel-plugin-transform-remove-console": "^6.9.4", "babel-preset-react-native": "^4.0.1", "detox": "^18.17.0", "eslint": "^8.29.0", "eslint-config-prettier": "^6.12.0", "eslint-config-standard": "^17.0.0", "eslint-formatter-rdjson": "^1.0.5", "eslint-html-reporter": "^0.7.4", "eslint-plugin-import": "^2.26.0", "eslint-plugin-n": "^15.6.0", "eslint-plugin-no-unused-react-component-methods": "^1.1.0", "eslint-plugin-prettier": "^3.1.4", "eslint-plugin-promise": "^6.1.1", "eslint-plugin-react": "^7.32.2", "eslint-plugin-react-hooks": "^4.1.2", "eslint-plugin-sonarjs": "^0.17.0", "husky": "^6.0.0", "jest": "^27.0.0", "jetifier": "^1.6.6", "metro-react-native-babel-preset": "^0.59.0", "patch-package": "^6.4.7", "prettier": "^2.3.0", "pretty-quick": "^3.1.0", "react-test-renderer": "16.13.1", "reactotron-react-native": "^5.0.0", "rn-async-storage-flipper": "0.0.9" }, "jest": { "preset": "react-native" } } ``` #### `firebase.json` for react-native-firebase v6: ```json { "react-native": { "crashlytics_debug_enabled": true, "crashlytics_disable_auto_disabler": true, "crashlytics_auto_collection_enabled": true, "crashlytics_is_error_generation_on_js_crash_enabled": true, "crashlytics_javascript_exception_handler_chaining_enabled": true } } ```

iOS

Click To Expand

#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ``` platform :ios, '13.0' # Override Firebase SDK Version $FirebaseSDKVersion = '10.5.0' require_relative '../node_modules/react-native/scripts/react_native_pods' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' pod 'Firebase', :modular_headers => true pod 'FirebaseCoreInternal', :modular_headers => true pod 'GoogleUtilities', :modular_headers => true pod 'FirebaseCore', :modular_headers => true pod 'GoogleMLKit/TextRecognition' pod 'GoogleMLKit/BarcodeScanning' pod 'GoogleMLKit/FaceDetection' pod 'TrustKit' def shared_pods permissions_path = '../node_modules/react-native-permissions/ios' # pod 'Fabric' # pod 'Crashlytics' pod 'RNFBApp', :path => '../node_modules/@react-native-firebase/app' pod 'RNFBCrashlytics', :path => '../node_modules/@react-native-firebase/crashlytics' # pod 'Firebase/MLVision', '~> 6.28.0' # pod 'Firebase/MLVisionTextModel' # pod 'Firebase/MLVisionFaceModel','~> 6.28.0' pod 'TensorFlowLiteObjC', '~> 2.0.0' pod 'GoogleDataTransport', '~> 9.1' pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec" pod 'Permission-Contacts', :path => "#{permissions_path}/Contacts.podspec" pod 'Permission-FaceID', :path => "#{permissions_path}/FaceID.podspec" pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways.podspec" pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse.podspec" pod 'Permission-MediaLibrary', :path => "#{permissions_path}/MediaLibrary.podspec" pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications.podspec" pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary.podspec" end target 'M2ULife' do config = use_native_modules! use_react_native!(:path => config["reactNativePath"]) shared_pods pod 'RNSentry', :path => '../node_modules/@sentry/react-native' end target 'M2ULife Development' do config = use_native_modules! use_react_native!(:path => config["reactNativePath"]) shared_pods end target 'M2ULife SIT' do config = use_native_modules! use_react_native!(:path => config["reactNativePath"]) shared_pods end target 'M2ULife UAT' do config = use_native_modules! use_react_native!(:path => config["reactNativePath"]) shared_pods end target 'M2ULife CIND' do config = use_native_modules! use_react_native!(:path => config["reactNativePath"]) shared_pods end target 'M2ULife KLDC' do config = use_native_modules! use_react_native!(:path => config["reactNativePath"]) shared_pods end target 'M2ULife NTT' do config = use_native_modules! use_react_native!(:path => config["reactNativePath"]) shared_pods end target 'M2ULife Staging' do config = use_native_modules! use_react_native!(:path => config["reactNativePath"]) shared_pods end target 'M2ULife Production' do config = use_native_modules! use_react_native!(:path => config["reactNativePath"]) shared_pods end # Enable flippers use_flipper!({ 'Flipper' => '0.91.1' }) post_install do |installer| # Fix for XCode 12.5 find_and_replace("../node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm", "_initializeModules:(NSArray> *)modules", "_initializeModules:(NSArray *)modules") flipper_post_install(installer) fix_library_search_paths(installer) installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = "arm64" config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = "" config.build_settings['CODE_SIGNING_REQUIRED'] = "NO" config.build_settings['CODE_SIGNING_ALLOWED'] = "NO" # # Uncomment below code if port 8081 used by McAfee # if config.name == 'Debug' # config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)'] # config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] + ['RCT_METRO_PORT=8082'] # end end end end def fix_library_search_paths(installer) def fix_config(config) lib_search_paths = config.build_settings["LIBRARY_SEARCH_PATHS"] if lib_search_paths if lib_search_paths.include?("$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)") || lib_search_paths.include?("\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"") # $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME) causes problem with Xcode 12.5 + arm64 (Apple M1) # since the libraries there are only built for x86_64 and i386. lib_search_paths.delete("$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)") lib_search_paths.delete("\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"") if !(lib_search_paths.include?("$(SDKROOT)/usr/lib/swift") || lib_search_paths.include?("\"$(SDKROOT)/usr/lib/swift\"")) # however, $(SDKROOT)/usr/lib/swift is required, at least if user is not running CocoaPods 1.11 lib_search_paths.insert(0, "$(SDKROOT)/usr/lib/swift") end end end end end def find_and_replace(dir, findstr, replacestr) Dir[dir].each do |name| text = File.read(name) replace = text.gsub(findstr,replacestr) if text != replace puts "Fix: " + name File.open(name, "w") { |file| file.puts replace } STDOUT.flush end end Dir[dir + '*/'].each(&method(:find_and_replace)) end ``` ```ruby # N/A ``` #### `AppDelegate.m`: ```objc // N/A ```


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 13.2 CPU: (10) arm64 Apple M1 Pro Memory: 348.73 MB / 16.00 GB Shell: 3.6.0 - /opt/homebrew/bin/fish Binaries: Node: 16.13.2 - ~/.nvm/versions/node/v16.13.2/bin/node Yarn: 1.22.15 - ~/.nvm/versions/node/v16.13.2/bin/yarn npm: 8.1.2 - ~/.nvm/versions/node/v16.13.2/bin/npm Watchman: Not Found Managers: CocoaPods: 1.11.3 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4 Android SDK: Not Found IDEs: Android Studio: 2022.1 AI-221.6008.13.2211.9619390 Xcode: 14.3/14E222b - /usr/bin/xcodebuild Languages: Java: 11.0.16 - /usr/bin/javac Python: Not Found npmPackages: @react-native-community/cli: Not Found react: 16.13.1 => 16.13.1 react-native: 0.63.3 => 0.63.3 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:** - `e.g. 5.4.3` - **`Firebase` module(s) you're using that has the issue:** - `e.g. Instance ID` - **Are you using `TypeScript`?** - `Y/N` & `VERSION`


github-actions[bot] commented 1 year ago

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.