Open
Description
New Issue Checklist
- I am not disclosing a vulnerability.
- I am not just asking a question.
- I have searched through existing issues.
- I can reproduce the issue with the latest versions of Parse Server and the Parse JS SDK.
Issue Description
The encode
function is called recursively without a ceiling, causing the entire service to crash with no hint as to the originating call, even with VERBOSE=1
enabled. All I know is that the error is thrown from this line:
if (value && typeof value === 'object') {
const output = {};
for (const k in value) {
+ output[k] = encode(value[k], disallowObjects, forcePointers, seen, offline);
}
return output;
}
Steps to reproduce
Unsure, inherited legacy code and there is no hint as to which network call is causing this issue.
Actual Outcome
Program errors out without any hint as to where the error is coming from.
Expected Outcome
The function to execute properly. Two possible improvements to the library come to mind:
- Give further context about where the error is coming from
- Have a limit on the number of calls within the function and truncate after the limit is hit, giving a warning in the console but not causing the program to error out
Environment
Server
- Parse Server version:
7.0.0
- Operating system:
node:18 Docker image
- Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc):
Local
Database
- System (MongoDB or Postgres):
MongoDB
- Database version:
5.9.2
- Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc):
Local
Client
- Parse JS SDK version:
5.0.0
Logs
An uncaught exception occurred: Maximum call stack size exceededStack Trace:
RangeError: Maximum call stack size exceeded
at encode (/api/node_modules/.pnpm/[email protected]/node_modules/parse/lib/node/encode.js:23:16)
at /api/node_modules/.pnpm/[email protected]/node_modules/parse/lib/node/encode.js:61:14
at Array.map (<anonymous>)
at encode (/api/node_modules/.pnpm/[email protected]/node_modules/parse/lib/node/encode.js:60:18)
at encode (/api/node_modules/.pnpm/[email protected]/node_modules/parse/lib/node/encode.js:67:19)
at encode (/api/node_modules/.pnpm/[email protected]/node_modules/parse/lib/node/encode.js:67:19)
at encode (/api/node_modules/.pnpm/[email protected]/node_modules/parse/lib/node/encode.js:67:19)
at encode (/api/node_modules/.pnpm/[email protected]/node_modules/parse/lib/node/encode.js:67:19)
at encode (/api/node_modules/.pnpm/[email protected]/node_modules/parse/lib/node/encode.js:67:19)