Skip to content

Parse Query results (AWS + MongoLab + Android) #414

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
rafapetter opened this issue Feb 14, 2016 · 6 comments
Closed

Parse Query results (AWS + MongoLab + Android) #414

rafapetter opened this issue Feb 14, 2016 · 6 comments
Labels
type:question Support or code-level question

Comments

@rafapetter
Copy link

I have migrated to AWS, MonboLab(data migrated according to parse guide) and am currently testing on android. I have the latest parse-server and latest android SDK version running. So here are 2 problems found after the migration, when android return results from the ParseQuery:

  1. when there are 4 pointers, using query.include("pointer"), the data returned from the pointers are null, which shouldn't since checking mongo 3 pointers have data, and only 1 is null. When I remove this pointer that returns null, the others 3 pointers return data normally. So, is there a include limit issue? how that null pointer is messing all other pointers?

  2. data that have Read or Write permission ACL to the current user are not being returned, unless the data has public permission. Is there any ACL migration setup I'm missing here? I've checked mongo and all classes seemed to have been migrated normally.

Here is the query definition:

ParseQuery<ParseObject> query = ParseQuery.getQuery("Offer");
query.include("seller");
query.include("buyer");
query.include("seller_currency_rate");
query.include("buyer_currency_rate");
query.whereEqualTo("active", true);
query.whereNotEqualTo("seller", currentUser);
query.whereNotEqualTo("buyer", currentUser);
query.whereGreaterThanOrEqualTo("amount", currentUser.getDouble("minimum_amount"));
query.whereLessThanOrEqualTo("amount", currentUser.getDouble("maximum_amount"));
query.whereEqualTo("seller_currency", currentUser.getString("seller_currency"));
query.whereEqualTo("buyer_currency", currentUser.getString("buyer_currency"));
query.orderByDescending("createdAt");
query.findInBackground(new FindCallback<ParseObject>() {

Appreciate any help. Thanks!

@rafapetter
Copy link
Author

Did anybody have issues with ACL when doing a ParseQuery?

@gfosco
Copy link
Contributor

gfosco commented Feb 26, 2016

This is a possible bug, and a test-case could be written to test if a null pointer causes failing results. Are you still having this issue on 2.1.3?

@rafapetter
Copy link
Author

Thanks Fosco,

So, I was on 2.0, now with 2.1.3 there seems to be no problem querying null pointer. But... now I can't login with any email/password user account, exception was facebook user account which let me confirm the null pointer issue was gone. And the problem 2 I've mentioned above, related to ACL still persists on android, I can't see records that have ACL read or write to current user, I only see records that have ACL public read/write access.

Just so you know, after updating to 2.1.3, on android I have only changed the server url and reinstalled the app.

I'm also testing this migration app on iOS, with same configuration keys, mongo, server, everything... and there was no problem related to user accessing, or any ACL issue so far. Cloud code seems to be working fine too.

@gfosco
Copy link
Contributor

gfosco commented Feb 26, 2016

If you can set the environment variable VERBOSE=1 and capture the queries from iOS/Android and spot any difference, that would help... Just added a PR to fix some android specific functionality earlier, and I'm sure there's more to be done.

@rafapetter
Copy link
Author

There you go. I don't see any significant difference.

Android

GET /parse/classes/Offer { host: 'parseserver-xxx-env.elasticbeanstalk.com',
  'x-real-ip': '172.31.27.214',
  'x-forwarded-for': '201.6.213.21, 172.31.27.214',
  'content-length': '305',
  'accept-encoding': 'gzip',
  'content-type': 'application/json',
  'user-agent': 'Parse Android SDK 1.13.0 (com.xxxx.xxxx/4) API Level 21',
  'x-newrelic-id': 'xxxxxxx==',
  'x-parse-app-build-version': '4',
  'x-parse-app-display-version': '1.1.2',
  'x-parse-application-id': 'xxxxxxxx',
  'x-parse-client-key': 'xxxxx',
  'x-parse-client-version': 'a1.13.0',
  'x-parse-installation-id': 'xxxxxxxxxx',
  'x-parse-os-version': '5.0.2',
  'x-parse-session-token': 'r:xxxxx',
  'x-forwarded-port': '80',
  'x-forwarded-proto': 'http' } {
  "include": "buyer_currency_rate,seller,buyer,seller_currency_rate",
  "where": "{\"$or\":[{\"seller\":{\"__type\":\"Pointer\",\"className\":\"_User\",\"objectId\":\"5glMupmjyC\"}},{\"buyer\":{\"__type\":\"Pointer\",\"className\":\"_User\",\"objectId\":\"5glMupmjyC\"}}]}",
  "order": "-updatedAt"
}

iOS

GET /parse/classes/Offer { host: 'parseserver-xxx-env.elasticbeanstalk.com',
  'x-real-ip': '172.31.60.56',
  'x-forwarded-for': '201.6.213.21, 172.31.60.56',
  'content-length': '245',
  accept: '*/*',
  'accept-encoding': 'gzip, deflate',
  'accept-language': 'pt-br',
  'content-type': 'application/json; charset=utf-8',
  'user-agent': 'xxxx/3 CFNetwork/758.2.8 Darwin/15.3.0',
  'x-newrelic-id': 'xxxx==',
  'x-parse-app-build-version': '3',
  'x-parse-app-display-version': '1.1.2',
  'x-parse-application-id': 'xxxxx',
  'x-parse-client-key': 'xxxxx',
  'x-parse-client-version': 'i1.12.0',
  'x-parse-installation-id': 'xxxx',
  'x-parse-os-version': '9.2 (15D21)',
  'x-parse-session-token': 'r:xxxx',
  'x-forwarded-port': '80',
  'x-forwarded-proto': 'http' } {
  "include": "buyer,seller",
  "order": "-updatedAt",
  "where": {
    "$or": [
      {
        "seller": {
          "objectId": "gghAJsj2dy",
          "className": "_User",
          "__type": "Pointer"
        }
      },
      {
        "buyer": {
          "objectId": "gghAJsj2dy",
          "className": "_User",
          "__type": "Pointer"
        }
      }
    ]
  },
  "limit": "25"
}

@gfosco
Copy link
Contributor

gfosco commented Mar 6, 2016

Glad the null pointer issue is fixed... The ACL issue seems well covered in tests, so you'd need to provide some more details or do some troubleshooting / test writing your self. If you are still having issues, please open a new issue. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:question Support or code-level question
Projects
None yet
Development

No branches or pull requests

3 participants