Getting "App: request location failed (CustomError -1)" error on Android 34 Emulator

Hi all,

Getting the following errors when I try to log in a user;

ERROR [Realm.App - error] App: request location failed (CustomError -1): request to https://services.cloud.mongodb.com/api/client/v2.0/app/application-0-xxxxx/location failed, reason: Network request failed
ERROR [Realm.App - error] App: log_in_with_credentials failed: 0 message: request to https://services.cloud.mongodb.com/api/client/v2.0/app/application-0-xxxxx/location failed, reason: Network request failed

I’m using the following;

├── react@18.2.0
├── realm@12.13.1
├── @realm/react@0.10.0

And my App is set up as;

  <AppProvider id={Config.REALM_APP_ID}>
    <UserProvider fallback={<LogInScreen />}>
      <RealmProvider
        sync={{
          flexible: true,
          initialSubscriptions: {
            update(subs, realm) {
              subs.add(realm.objects(Question));
              subs.add(realm.objects(Survey));
            },
          },
        }}
      >
        <GestureHandlerRootView>
          <NavigationContainer>
            <Tabs />
          </NavigationContainer>
        </GestureHandlerRootView>
      </RealmProvider>
    </UserProvider>
  </AppProvider>

Works on a real device but fails on emulator.

The things with emulators like any VM is tricky, check:

  • DNS
  • Proxy settings
  • firewall
  • Local Host Resolution
  • Wi-Fi/Internet connection
  • Rebuild the emulator

But these are the things you need to check for your Android Studio and Emulator setup.