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

Failed to lookup host on all versions error #1417

Open
mariugo opened this issue Mar 19, 2024 · 0 comments
Open

Failed to lookup host on all versions error #1417

mariugo opened this issue Mar 19, 2024 · 0 comments

Comments

@mariugo
Copy link

mariugo commented Mar 19, 2024

I’m getting a host lookup error, which I can bypass by running the project without Uncaught Exceptions. I also use this endpoint/graph on the web, via React: apollo/client 3.8.1 and get no erros.

What I would like to know is if there is any configuration on the server side in Apollo("@apollo/server": "4.0.4") in order to avoid this issue. As I said before, the app runs, but not with errors.

I’m currently using:
graphql: ^5.1.3
graphql_flutter: ^5.1.2
http: ˆ1.2.0
Flutter 3.19.3, testing it from macOS M1:

My connection goes through http, but there’s also dio on the project for its own reasons, not sure if it would make any difference changing to it. Code implementation below:

@override
  Future<http.StreamedResponse> send(http.BaseRequest request) {
    return _client
        .send(request)
        .timeout(const Duration(seconds: 30))
        .then((response) async {
      if (response.headers.containsKey('api-update-warning')) {
        GetIt.I.get<OttoNotificationCenter>().notifyNewVersionAvailable();
      }
      if (response.statusCode == 400) {
        final responseString = await response.stream.bytesToString();
        if (responseString.contains('FORBIDDEN_API_VERSION')) {
          GetIt.I.get<OttoNotificationCenter>().notifyForbiddenApiVersion();
          throw NotAllowedAPIVersionException();
        } else if (responseString.contains('UNAUTHENTICATED')) {
          GetIt.I.get<OttoNotificationCenter>().notifyUserUnauthenticated();
          throw UnauthenticatedException();
        }
      }
      return response;
    });
  }
}

To Reproduce (MUST BE PROVIDED)

My connection goes through http, but there’s also dio on the project for its own reasons, not sure if it would make any difference changing to it.

This is the error I get through any query, mutation and so on:

  1. When I use 'graphql' '5.1.3' and 'http' '1.2.0' only with Uncaught Exceptions on VS Code checked
  2. I receive the following error from socket_patch.dart:
Line: 520
 if (isErrorResponse(response)) {
        throw createError(response, "Failed host lookup: '$host'");
      }
Response [ 
 No address associated with hostname
]

Line: 633
final addresses = await lookup(host, type: type);
Host: [dev.otto.com.vc].  // which goes to: (dev.otto.com.vc/graphql)
Type: InternetAdressType: IPv6
  1. But I would like to receive 'No host lookup erros since it does not normally appear. '

Expected behavior
Because it does run if Uncaught Exceptions is not checked, I would like either to solve on the client/flutter side or even if there's a chance or any docs to resolve it under the server side.

device / execution context
Simulator, Android emulator and physical devices all throught requests on API published on AWS

Other useful/optional fields

additional context

  • What backend are you trying to use? Apollo 4 in AWS.
  • If you have a network issue, does your operation work with GraphiQL? It does work.

additional notes
I am new to GraphQL

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

No branches or pull requests

1 participant