parse-community / parse-community/parse-server

Unexpected behavior on the `exists` method

Open
#8,117 8 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

type:bug
Dominant language
JavaScript
Stars
21.4k
Forks
4.8k
Avg merge
7h 45m
Merged PRs (30d)
11

Description

Issue Description

An object exists in the database. You need a sessionToken to access it.

If you use the Parse.Object exists method without sessionToken instead of throwing an error, it resolves with the value false. I think it's quite an unexpected behavior. It's caused by theses lines of code

https://github.com/parse-community/Parse-SDK-JS/blob/f2d76805000488fefce2b0c2e73d8953007f2b1c/src/ParseObject.js#L972-L974

And comes from this discussion : https://github.com/parse-community/Parse-SDK-JS/pull/898#discussion_r316447203

Steps to reproduce
  • Create an object in database with limited access
  • Try Catch the exits method without any sessionToken
Expected Results

It should throw an error

Actual Outcome

It does not throw, it returns false as if the object do not exist

Test Case

To accurately reproduce your issue. Add your test cases here and read the Contributing Guide to run the tests.

Environment Setup
  • Server

    • parse-server version (Be specific! Don't say 'latest'.) : 4.1.0
    • Operating System: MacOS
    • Localhost or remote server? localhost
  • JS SDK

    • JS SDK version: [FILL THIS OUT]
    • Application? (Browser, Node, React-Native, etc): [FILL THIS OUT]
Logs/Trace

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the linked ParseObject.js lines that implement the exists method, then review the integration tests under the Parse-SDK-JS integration/test directory. Reproduce the limited-access object case without a sessionToken and confirm that the completed behavior matches the issue's expected error handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.