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

error when use livequery with query.fields( updated, may someone help make a PR?) #5764

Closed
akg1234 opened this issue Jul 4, 2019 · 6 comments · Fixed by #5790
Closed

error when use livequery with query.fields( updated, may someone help make a PR?) #5764

akg1234 opened this issue Jul 4, 2019 · 6 comments · Fixed by #5790
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@akg1234
Copy link

akg1234 commented Jul 4, 2019

Issue Description

get error when using live query with query.fields
but this work on 2.8.4

Steps to reproduce

this is OK

{
  "op": "subscribe",
  "requestId": 1,
  "query": {
      "className": "Player",
      "where": {"name": "test"}
  },
  "sessionToken": "" // Optional
}

this get error

{
  "op": "subscribe",
  "requestId": 1,
  "query": {
      "className": "Player",
      "where": {"name": "test"},
      "fields": ["name"] // Optional
  },
  "sessionToken": "" // Optional
}

Expected Results

{"op":"create","clientId":"xxx","requestId":10,"object":xxxxxxx,"original":null}

Actual Outcome

(node:1468) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'className' of null

    at Client._toJSONWithFields (/rbd/pnpm-volume/3de49c66-6120-4e8e-822d-0dc5af59b3dd/node_modules/.registry.npmjs.org/parse-server/3.5.0/node_modules/parse-server/lib/LiveQuery/Client.js:95:50)

    at Client.pushCreate (/rbd/pnpm-volume/3de49c66-6120-4e8e-822d-0dc5af59b3dd/node_modules/.registry.npmjs.org/parse-server/3.5.0/node_modules/parse-server/lib/LiveQuery/Client.js:79:39)

    at _matchesCLP.then.then (/rbd/pnpm-volume/3de49c66-6120-4e8e-822d-0dc5af59b3dd/node_modules/.registry.npmjs.org/parse-server/3.5.0/node_modules/parse-server/lib/LiveQuery/ParseLiveQueryServer.js:293:33)

    at process._tickCallback (internal/process/next_tick.js:68:7)

(node:1468) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)

Environment Setup

  • Server

    • parse-server version (Be specific! Don't say 'latest'.) : 3.0.0-3.5.0
    • Operating System: [FILL THIS OUT]
    • Hardware: [FILL THIS OUT]
    • Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): [FILL THIS OUT]
  • Database

    • MongoDB version: [FILL THIS OUT]
    • Storage engine: [FILL THIS OUT]
    • Hardware: [FILL THIS OUT]
    • Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): [FILL THIS OUT]

Logs/Trace

@davimacedo
Copy link
Member

@akg1234 thanks for reporting. Would you be willed to open a PR with a failing test for this case?

@TomWFox TomWFox added the type:bug Impaired feature or lacking behavior that is likely assumed label Jul 6, 2019
@akg1234
Copy link
Author

akg1234 commented Jul 8, 2019

How to make a pull request?

@akg1234 thanks for reporting. Would you be willed to open a PR with a failing test for this case?

@TomWFox
Copy link
Contributor

TomWFox commented Jul 8, 2019

@akg1234 Check out the contributing guide - first steps are to fork the parse server repo and clone it to your local machine.

@akg1234
Copy link
Author

akg1234 commented Jul 8, 2019

@akg1234 Check out the contributing guide - first steps are to fork the parse server repo and clone it to your local machine.

oh
this maybe too difficult for me.
i only know the problem but i don't know how to fix it.

@davimacedo
Copy link
Member

@akg1234 you don't need to fix it. If possible we only wanted you to write a failing test case that shows the problem and open a PR with it so other developers can tackle the problem. You can find the other Live Query test cases in this file and you can use them as reference to write a new one.

@akg1234 akg1234 changed the title error when use livequery with query.fields error when use livequery with query.fields( updated, may someone help make a PR?) Jul 9, 2019
@akg1234
Copy link
Author

akg1234 commented Jul 9, 2019

@akg1234 you don't need to fix it. If possible we only wanted you to write a failing test case that shows the problem and open a PR with it so other developers can tackle the problem. You can find the other Live Query test cases in this file and you can use them as reference to write a new one.

it is still too difficult to me
i update the description of the bug
hope someone can help me

dplewis added a commit that referenced this issue Jul 10, 2019
Close:  #5764

Fix logic handling null original object
dplewis added a commit that referenced this issue Jul 10, 2019
Close:  #5764

Fix logic handling null original object
UnderratedDev pushed a commit to UnderratedDev/parse-server that referenced this issue Mar 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants