Skip to content

Error when passing null as Parse.Cloud.run option #2622

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
4 tasks done
modime opened this issue May 23, 2025 · 4 comments · Fixed by #2623
Closed
4 tasks done

Error when passing null as Parse.Cloud.run option #2622

modime opened this issue May 23, 2025 · 4 comments · Fixed by #2623
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@modime
Copy link
Contributor

modime commented May 23, 2025

New Issue Checklist

Issue Description

This bug was first found in https://github.com/parse-community/parse-server/ (see issue parse-community/parse-server#9766)

In _getRequestOptions in file ParseObject.js the parameter options is set to {} if it has no value. This works for values like '', undefined or if it is empty, but if it is null the code breaks.

Steps to reproduce

Call the function Parse.Cloud.run(<name>, data, null); or _ParseObject.default._getRequestOptions(null); directly.

Actual Outcome

Error:

TypeError: Cannot convert undefined or null to object
    at hasOwn (<anonymous>)
    at Function._getRequestOptions (/Users/#################/node_modules/parse/lib/node/ParseObject.js:423:9)
    at Object.run (/Users/#################/node_modules/parse/lib/node/Cloud.js:57:47)
…

Expected Outcome

When no options _getRequestOptions should return {}

Some kind of null check for the parameter options.

if(!options){
    return requestOptions;
}

Environment

I have tested this in 8.2.0 and 8.2.1-alpha.2. Error occurs in both.

The function does not exists in 7.5.2

Server

  • Parse Server version: 8.2.0
  • Operating system: macOS 15.5
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): local

Database

  • System (MongoDB or Postgres): MongoDB
  • Database version: macOS 15.5
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): local

Client

  • SDK (iOS, Android, JavaScript, PHP, Unity, etc): Node
  • SDK version: 22.14.0

Client

  • Parse JS SDK version: 6.1.0
Copy link

parse-github-assistant bot commented May 23, 2025

🚀 Thanks for opening this issue!

ℹ️ You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.

@mtrezza mtrezza added the type:bug Impaired feature or lacking behavior that is likely assumed label May 24, 2025
@mtrezza
Copy link
Member

mtrezza commented May 24, 2025

A fix should be fairly easy, do you want to give it a try and open a PR?

@mtrezza mtrezza changed the title Fix: null check in _getRequestOptions Error when passing null as Parse.Cloud.run option May 24, 2025
@modime
Copy link
Contributor Author

modime commented May 24, 2025

Yes. I have a branch I can push later today.

@modime
Copy link
Contributor Author

modime commented May 24, 2025

@mtrezza I have now made a PR for this. #2623

This is my first ever addition to the Parse community so please help me getting all terminology, tags, links and stuff as you want it. Thanks.

modime pushed a commit to modime/Parse-SDK-JS that referenced this issue Jun 2, 2025
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
2 participants