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.63k stars 2.2k forks source link

[πŸ›] πŸ”₯ messaging().getToken() throws error when using a VPN #6762

Closed CallbackDan closed 1 year ago

CallbackDan commented 1 year ago

Issue

I'm using @react-native-firebase/messaging to get the iOS device's FCM token. I'm calling messaging().getToken() but an error is thrown when I'm connected to my VPN (NordVPN) (error is shown below). When I disable my VPN and make the call, it works as expected, doesn't throw an error and returns the token.

Error: [messaging/unknown] A server with the specified hostname could not be found.

Project Files

Javascript

Click To Expand

`import messaging from '@react-native-firebase/messaging';` `const token = await messaging().getToken();` #### `package.json`: "@react-native-firebase/app": "16.4.6", "@react-native-firebase/messaging": "16.4.6" #### `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 # 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.0.1 CPU: (8) arm64 Apple M1 Memory: 283.23 MB / 8.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.4.2 - ~/.nvm/versions/node/v16.4.2/bin/node Yarn: Not Found npm: 8.1.3 - ~/.nvm/versions/node/v16.4.2/bin/npm Watchman: Not Found Managers: CocoaPods: 1.11.3 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.1, iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1 Android SDK: Not Found IDEs: Android Studio: 2021.3 AI-213.7172.25.2113.9123335 Xcode: 14.1/14B47b - /usr/bin/xcodebuild Languages: Java: 18.0.2.1 - /Library/Java/JavaVirtualMachines/jdk-18.0.2.1.jdk/Contents/Home/bin/javac npmPackages: @react-native-community/cli: ^6.4.0 => 6.4.0 react: ^17.0.2 => 17.0.2 react-native: ^0.66.4 => 0.66.4 react-native-macos: Not Found npmGlobalPackages: *react-native*: Not Found ``` - **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:** - `16.4.6` - **`Firebase` module(s) you're using that has the issue:** - `@react-native-firebase/messaging` - **Are you using `TypeScript`?** - `N`

mikehardy commented 1 year ago

I have similar issues when I use NordVPN, this is a general firebase problem related to firebase servers not trusting those networks since they are often used for abuse. You'll have to take this up with official firebase support channels - not saying it is not an issue just saying it is not within our control at all here. If you do so please paste links to related items here for others that may run into the same thing, but I'll close as not actionable

CallbackDan commented 1 year ago

Ah ok. Will do- thanks @mikehardy