Skip to content

Undefined Location null error when querying #345

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

Closed
dali546 opened this issue Jun 22, 2019 · 3 comments
Closed

Undefined Location null error when querying #345

dali546 opened this issue Jun 22, 2019 · 3 comments

Comments

@dali546
Copy link

dali546 commented Jun 22, 2019

I've looked through other issues but can't find a solution. When I am making a query with my client, i get an error where all data is null

To Reproduce
Steps to reproduce the behavior:

// globals.dart
GraphQLClient client;
// main.dart
void main() async {
  ...
  HttpLink link = HttpLink(uri: "http://127.0.0.1:8000/graphql");
  client = GraphQLClient(
    cache: InMemoryCache(),
    link: link,
  );
  runApp(AppComponent(store: store));
}

I am using Flutter BLoC so i am calling the query in my BLoC method

loadEvents() async {
    try {
      QueryResult data = await client
          .query(QueryOptions(document: getPosts));
      print(data.data);
    } catch (e) {
      print(e);
    }
  }

const getPosts = '''
      query {
        event(id:5) {
            title
            description
            user {
              profile {
                forename
              }
            }
        }
      }
      ''';

I have tried both with and without ValueNotifier and with and without wrapping MaterialApp in a GraphQLProvider. same result

Expected behavior
I expect it to work? and produce the results from my graphql endpoint. i used PHPs GraphQL Playground with the exact same query and it pulled results... not sure what im doing wrong

Screenshots
image

Desktop (please complete the following information):

  • OS: Ubuntu
  • Version 18.04

Smartphone (please complete the following information):

  • Device: OnePlus One
  • OS: Android Pie
  • Version: 9.0

Additional context
I am using this in conjunction with the BLoC pattern. so I dont want to make requests withing my UI widgets.

@micimize
Copy link
Collaborator

See if the result hasErrors or is loading

@dali546
Copy link
Author

dali546 commented Jun 22, 2019

Never mind.
A simple fact of knowing that localhost on my Android device does not mean my PC

@dali546 dali546 closed this as completed Jun 22, 2019
@dali546
Copy link
Author

dali546 commented Jun 22, 2019

#186 is similar

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

2 participants