Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxy support #8235

Open
3 of 5 tasks
Kecsiiii opened this issue Jan 17, 2025 · 1 comment
Open
3 of 5 tasks

Proxy support #8235

Kecsiiii opened this issue Jan 17, 2025 · 1 comment
Labels

Comments

@Kecsiiii
Copy link

Kecsiiii commented Jan 17, 2025

Issue

Hello everyone,
First of all thanks for the great work!

I have an application which uses firebase realtime DB for one of it's functionality.
One of our clients has a corporate proxy set up, which should allow all communication to pass trough.

What we are experiencing is that NO realtime DB related communication works with a proxy on neither (android and iOS) platforms.

Our suspicion is that no proxy is considered or the proxy settings are not used at all.
Could this be the case?

If so, is there any workaround for this?

Without the proxy, everything works just fine, but unfortunately the proxy is a requirement here.


Javascript

One relevant code snippet that should work but does not return anything:

import database, { firebase, FirebaseDatabaseTypes } from '@react-native-firebase/database';

...

function getReference(guid: string): Promise<FirebaseDatabaseTypes.Reference | undefined> {
    const db = firebase.app().database(firebaseDatabaseUrl);
    return db.ref(`${firebaseCollectionName}/${COLLECTION_NAME}/${departmentUuid}/${guid}`);
}

const references = await Promise.all(entities.map(({ guid }) => this.getReference(guid)));

const promisses = references.map((ref) => {
	return new Promise<SomeType | undefined>((resolve) => {
		if (!ref) {
			resolve(undefined);
			return;
		}
		ref.orderByChild('timestamp')
			.limitToLast(1)
			.once('value', (snapshot: FirebaseDatabaseTypes.DataSnapshot) => {
				snapshot.hasChildren() ?
					snapshot.forEach((childSnapshot: FirebaseDatabaseTypes.DataSnapshot | null) => {
						resolve(this.firebaseSnapshotToDto(childSnapshot));
						return true;
					})
					:
					resolve(undefined);
			});
	});
});

const dtos = await Promise.all(promisses);

package.json:

"dependencies": {
    "@react-native-firebase/app": "19.3.0",
    "@react-native-firebase/auth": "19.3.0",
    "@react-native-firebase/crashlytics": "19.3.0",
    "@react-native-firebase/database": "19.3.0",
    "@react-native-firebase/messaging": "19.3.0",
...
}

Environment

react-native info output:

info Fetching system and libraries information...
System:
  OS: macOS 14.1.1
  CPU: (8) arm64 Apple M1
  Memory: 89.17 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.18.0
    path: /usr/local/bin/node
  Yarn:
    version: 4.5.2
    path: ~/.yarn/bin/yarn
  npm:
    version: 10.8.2
    path: /usr/local/bin/npm
  Watchman:
    version: 2024.12.02.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /Users/user/.gem/ruby/2.7.4/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - visionOS 1.0
      - watchOS 10.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.1 AI-241.18034.62.2411.12071903
  Xcode:
    version: 15.2/15C500b
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.8.1
    path: /Users/user/Library/Java/JavaVirtualMachines/jbr-17.0.8.1/Contents/Home/bin/javac
  Ruby:
    version: 2.7.4
    path: /Users/user/.rubies/ruby-2.7.4/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.75.1
    wanted: 0.75.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

  • 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:
    • e.g. 19.3.0
  • Firebase module(s) you're using that has the issue:
    • @react-native-firebase/database
  • Are you using TypeScript?
    • Y & 5.0.4
@mikehardy
Copy link
Collaborator

"dependencies": {
    "@react-native-firebase/app": "19.3.0",
    "@react-native-firebase/auth": "19.3.0",
    "@react-native-firebase/crashlytics": "19.3.0",
    "@react-native-firebase/database": "19.3.0",
    "@react-native-firebase/messaging": "19.3.0",
}

I'll never understand why people request support on outdated versions, that's a warning flag for me 🤷, it looks unserious

At any rate, I don't believe proxies are supported based on upstream information, and it appears that gRPC (the underlying communication mechanism for database) needs configuration to use proxies but they aren't passed in from anywhere.

Specifically it looks like in native code on iOS you'll need to set grpc_proxy: firebase/firebase-ios-sdk#12563 (comment)

I imagine something similar may be necessary on Android as well...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants