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

Dio cannot resolve hostname http://127.0.0.1.lambdatest:port #2119

Closed
renehw opened this issue Feb 21, 2024 · 7 comments
Closed

Dio cannot resolve hostname http://127.0.0.1.lambdatest:port #2119

renehw opened this issue Feb 21, 2024 · 7 comments

Comments

@renehw
Copy link

renehw commented Feb 21, 2024

Package

dio

Version

5.4.1

Operating-System

Android

Output of flutter doctor -v

flutter doctor -v
[√] Flutter (Channel stable, 3.19.0, on Microsoft Windows [versÆo 10.0.22631.3155], locale pt-BR)
    • Flutter version 3.19.0 on channel stable at C:\Users\HansBoron\APPs\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision bae5e49bc2 (8 days ago), 2024-02-13 17:46:18 -0800
    • Engine revision 04817c99c9
    • Dart version 3.3.0
    • DevTools version 2.31.1
 
[√] Windows Version (Installed version of Windows is version 10 or higher)
 
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at C:\Users\HansBoron\AppData\Local\Android\sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-b2043.56-10550314)
    • All Android licenses accepted.
 
[√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
 
[X] Visual Studio - develop Windows apps
    X Visual Studio not installed; this is necessary to develop Windows apps.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components
 
[√] Android Studio (version 2023.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-b2043.56-10550314)
 
[√] VS Code (version 1.86.2)
    • VS Code at C:\Users\HansBoron\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.82.0
 
[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [versÆo 10.0.22631.3155]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 121.0.6167.185
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 121.0.2277.128
 
[√] Network resources
    • All expected network resources are available.
 
! Doctor found issues in 1 category.

Dart Version

3.3.0

Steps to Reproduce

The test form is a little complicated.

We are currently using the Lambdatest tool to perform manual tests using physical devices remotely.

To make the connection, we use a tool they provide called Underpass and in the app we use the url 'http://127.0.0.1.lambdatest:port'. The port refers to our local REST API.

Using this tool we do not obtain results, returning generic errors or timeouts.

We tested creating a native app with Kotlin using the Retrofit library for HTTP connections and we were successful.

Expected Result

A successful return is expected

Actual Result

Unhandled Dio errors or SocketException and Timeout

@renehw renehw added h: need triage This issue needs to be categorized s: bug Something isn't working labels Feb 21, 2024
@hansmboron
Copy link

I have the same problem when trying to run an app with dio in the lambdaTest tunnel
image

@Lewiz-QA
Copy link

Me too, when I try to use a Flutter App on LambdaTest using a local backend over UnderPass tunnel, I face the DioExceptions "errno=7" or "errno=111", which are very generic to identify what's the main cause of the problem.
One important point is that the same request that didn't run on app, works fine on Chrome present in some Real Device of LambdaTest.

@AlexV525
Copy link
Member

Is the service running on the device? If not, use the ip of your host device to access.

@renehw
Copy link
Author

renehw commented Feb 22, 2024

Does not work with local device IP. This device is accessed remotely.

@AlexV525
Copy link
Member

I'm not following here. Is 127.0.0.1 targeting the same device as where the Flutter app runs? Such as you are running Flutter on an Android device, but trying to access the 127.0.0.1.lambdatest on a macOS device.

@renehw
Copy link
Author

renehw commented Feb 22, 2024

We discovered in our tests that using https://pub.dev/packages/native_dio_adapter the problem does not occur. Using native_dio_adapter, we were able to connect the remote mobile device to our QA machine without any problems.

However, despite having managed to solve this problem, I believe there is a problem when using http Dart. As native_dio_adapter uses a native library for HTTP requests, the problem does not occur. I suggest carrying out a review at this point.

For now, the problem we were having is resolved.

@AlexV525
Copy link
Member

We cannot make any review until a detailed example is provided. I'm still not sure about the environment as I mentioned above:

I'm not following here. Is 127.0.0.1 targeting the same device as where the Flutter app runs? Such as you are running Flutter on an Android device, but trying to access the 127.0.0.1.lambdatest on a macOS device.

@AlexV525 AlexV525 added the h: need more info Further information is requested label Feb 26, 2024
@AlexV525 AlexV525 closed this as not planned Won't fix, can't repro, duplicate, stale Mar 18, 2024
@AlexV525 AlexV525 added i: no useful information and removed h: need more info Further information is requested h: need triage This issue needs to be categorized s: bug Something isn't working labels Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants