Skip to content

fix(rtdb): Support parsing non-US RTDB instance URLs #517

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

Merged
merged 3 commits into from
Dec 15, 2020
Merged

Conversation

hiranya911
Copy link
Contributor

@hiranya911 hiranya911 commented Dec 9, 2020

The SDK currently only supports production RTDB URLs with the hostname firebaseio.com. But RTDB instances deployed in non-US regions seem to have different hostnames like firebasedatabase.app. This PR implements support for such URLs.

The updated URL parsing scheme is as follows (in the specified order):

  1. If an HTTP URL is specified via app options we attempt to parse it as an emulator URL. Namespace must be specified in the URL as a query parameter.
  2. If the FIREBASE_DATABASE_EMULATOR_HOST environment variable is set, we use it as an emulator URL. Namespace is extracted from the databaseUrl app option.
  3. If an HTTPS URL is specified via app options, with no FIREBASE_DATABASE_EMULATOR_HOST, then we treat it as a production URL.

We don't check production URLs for any specific hostnames. But this can be added if necessary (given RTDB hostnames are a fixed set).

Resolves #514

RELEASE NOTE: Added support for handling RTDB URLs that point to instances hosted in non-US regions.

@hiranya911 hiranya911 assigned hiranya911 and unassigned yuchenshi Dec 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants