Skip to content

Error with ParseLiveListWidget - whereRelatedTo unsupported #450

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

Open
lucasolivierx1 opened this issue Sep 18, 2020 · 4 comments
Open

Error with ParseLiveListWidget - whereRelatedTo unsupported #450

lucasolivierx1 opened this issue Sep 18, 2020 · 4 comments
Labels
type:feature New feature or improvement of existing feature

Comments

@lucasolivierx1
Copy link

Hello!

I'm have an error with parse_server_sdk 1.0.27

its about ParseLiveListWidget.

Exemple, like doc


  await Parse().initialize(
    "OMMITED_APP_ID",
    "https://parseapi.back4app.com/",
    clientKey: "OMMITED_CLIENT_KEY",
    liveQueryUrl: 'wss://OMMITED_APP_NAME.back4app.io',
    autoSendSessionId: true,
    debug: true,
  );

ParseLiveListWidget<ParseObject>(
                        query: c.getQueryPets(),
                        childBuilder: (BuildContext context,
                            ParseLiveListElementSnapshot<ParseObject>
                                snapshot) {
                          if (snapshot.failed) {
                            return const Text('something went wrong!');
                          } else if (snapshot.hasData) {
                            return ListTile(
                              title: Text(
                                snapshot.loadedData.get("name"),
                              ),
                            );
                          } else {
                            return NoPetsAddedWidget();
                          }
                        },
                        scrollPhysics: ClampingScrollPhysics(),
                        shrinkWrap: true,
                        scrollDirection: Axis.horizontal,
                        duration: Duration(seconds: 1),
                      )

getQueryPets

    return QueryBuilder<ParseObject>(ParseObject('Pet'))
      ..whereRelatedTo(
          'Pets', '_User', Get.find<AppController>().getCurrentUser().id);

I give the error :

I/flutter (10291): LiveQuery: : Error: WebSocketException: Connection to 'https://OMMITED_APP_NAME.back4app.io:0#' was not upgraded to websocket
I/flutter (10291): ╭-- Parse Response
I/flutter (10291): Class: LiveQuery
I/flutter (10291): Function: ParseApiRQ.liveQuery
I/flutter (10291): Status Code: -1
I/flutter (10291): Type: UnknownError
I/flutter (10291): Exception: WebSocketException: Connection to 'https://OMMITED_APP_NAME.back4app.io:0#' was not upgraded to websocket
I/flutter (10291): ╰--

App Config On Parse website

@fischerscode
Copy link
Contributor

fischerscode commented Sep 18, 2020

It might be a problem with the relation. I don't even know if relations currently work. #416

Edit: Is your query working when using it without the ParseLiveListWidget?

@lucasolivierx1
Copy link
Author

lucasolivierx1 commented Sep 18, 2020

It might be a problem with the relation. I don't even know if relations currently work. #416

the relations with query works, but if i try get relations by object, dont work like:

//Teste for github
    ParseRelation relation = parseUser.getRelation("Pets");

    print(relation.toJson().toString());

//end test

Console Output:
I/flutter (11008): Bad state: No element

But in Parse website has relation.

Edit2

Edit: Is your query working when using it without the ParseLiveListWidget?

Yes its work, i update petList with query, like :


 Future<UserModel> mapParseToUser(ParseUser parseUser) async {
    QueryBuilder<ParseObject> query =
        QueryBuilder<ParseObject>(ParseObject('Pet'))
          ..whereRelatedTo('Pets', '_User', parseUser.objectId);

    final response = await query.query();

    List<PetModel> pets = List();

    response.results.forEach((element) {
      pets.add(PetModel.fromJson(element.toJson()));
    });

    return UserModel(
        email: parseUser.emailAddress,
        id: parseUser.objectId,
        password: parseUser.password,
        completeName: parseUser.username,
        avatarLink: parseUser.get(UserSchema.avatarLink),
        cellphone: parseUser.get(UserSchema.cellphone),
        type: UserType.values[0],
        pets: pets);
  }

@facuparedes
Copy link
Contributor

It might be a problem with the relation. I don't even know if relations currently work. #416

the relations with query works, but if i try get relations by object, dont work like:

//Teste for github
    ParseRelation relation = parseUser.getRelation("Pets");

    print(relation.toJson().toString());

//end test

Console Output:
I/flutter (11008): Bad state: No element

But in Parse website has relation.

Edit2

Edit: Is your query working when using it without the ParseLiveListWidget?

Yes its work, i update petList with query, like :


 Future<UserModel> mapParseToUser(ParseUser parseUser) async {
    QueryBuilder<ParseObject> query =
        QueryBuilder<ParseObject>(ParseObject('Pet'))
          ..whereRelatedTo('Pets', '_User', parseUser.objectId);

    final response = await query.query();

    List<PetModel> pets = List();

    response.results.forEach((element) {
      pets.add(PetModel.fromJson(element.toJson()));
    });

    return UserModel(
        email: parseUser.emailAddress,
        id: parseUser.objectId,
        password: parseUser.password,
        completeName: parseUser.username,
        avatarLink: parseUser.get(UserSchema.avatarLink),
        cellphone: parseUser.get(UserSchema.cellphone),
        type: UserType.values[0],
        pets: pets);
  }

Hi!
Right now I'm not using REST to query relations. I just configured Graphql, so then, get related data is easier.
Also, as you can see on #416, I couldn't get relation data with getRelation() method. I should look the code to see what happens there.
However, as I can see, your issue is about websocket server from Back4App. Do you have any other issues with that server? Can you test another subscription?

@lucasolivierx1
Copy link
Author

lucasolivierx1 commented Sep 18, 2020

Hello @FNPCMDs

Hi!
Right now I'm not using REST to query relations. I just configured Graphql, so then, get related data is easier.
Also, as you can see on #416, I couldn't get relation data with getRelation() method. I should look the code to see what happens there.

ok no problem. i'll use Graphql while this bug not fixed.

However, as I can see, your issue is about websocket server from Back4App. Do you have any other issues with that server? Can you test another subscription?

At moment i have only this error about websocket, because i trying a LiveQueryList test, i can create a new app and test, i'll put results as soon

with other app, same error

@fischerscode fischerscode changed the title Error with ParseLiveListWidget Error with ParseLiveListWidget - whereRelatedTo unsupported Oct 15, 2020
@mtrezza mtrezza added type:feature New feature or improvement of existing feature and removed type:improvement labels Dec 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New feature or improvement of existing feature
Projects
None yet
Development

No branches or pull requests

4 participants