Skip to content

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

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
modime opened this issue May 23, 2025 · 3 comments · Fixed by parse-community/Parse-SDK-JS#2623
Closed

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

modime opened this issue May 23, 2025 · 3 comments · Fixed by parse-community/Parse-SDK-JS#2623
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@modime
Copy link

modime commented May 23, 2025

New Issue Checklist

Issue Description

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 {}

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

Logs

Proposed solution

Some kind of null check for the parameter options. Like insert this on row 420:

if(!options){
    return requestOptions;
}
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.

@modime
Copy link
Author

modime commented May 23, 2025

@mtrezza mtrezza changed the title _getRequestOptions does not check for null value Error when passing null as Parse.Cloud.run option May 24, 2025
@mtrezza
Copy link
Member

mtrezza commented May 24, 2025

Replaced by parse-community/Parse-SDK-JS#2622.

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