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

localhost (10.0.2.2) not working for Android emulators #105

Open
shubhamsinghshubham777 opened this issue Jun 10, 2023 · 2 comments
Open
Labels
Investigate Working to figure out what's wrong! question Further information is requested

Comments

@shubhamsinghshubham777
Copy link

shubhamsinghshubham777 commented Jun 10, 2023

According to nhost's documentation, we must pass localhost or localhost:1337 as the value for subdomain and a blank/empty string for region if we want to develop using Nhost CLI. This is shown below as well:

Screenshot 2023-06-10 at 5 53 08 PM

But the issue here is we cannot use localhost on Android emulators. If we try to do so, we get the following error:

E/flutter ( 5240): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Failed host lookup: '10.0.2.2.auth..nhost.run'

Observe here, the URL contains a double dot .. because of the blank region which makes the URL invalid as the library does not consider 10.0.2.2 as localhost.

In order to access the parent device's localhost, we must use http://10.0.2.2 in the URL instead of localhost.

Please consider making this change in the library to enable development on Android Emulators as well.

@shubhamsinghshubham777
Copy link
Author

@mhadaily Could you look into this, please?

@mhadaily
Copy link
Contributor

Can you not use serviceUrls directly for local development?

      serviceUrls: ServiceUrls(
        authUrl: '',
        storageUrl: '',
        functionsUrl: '',
        graphqlUrl: '',
      ),
    );``` 
    

@mhadaily mhadaily added question Further information is requested Investigate Working to figure out what's wrong! labels Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Investigate Working to figure out what's wrong! question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants