You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If an error is thrown by Parse-Server on a Parse.User.save(), the SDK does not catch it and an Unhandled Promise Rejection error is raised, making it impossible for our app to catch the error.
There may be some sort of wrapper I am not aware of, but I gave a quick look to the code and to the untrained eye, it simply looks as though there is no try-catch block in the save() method of ParseUser (src/ParseUser.js). Same goes for other methods like destroy().
According to logs, error is raised at ParseObject.js:3137, but the absence of ParseUser in the error stack gives me the feeling it is indeed the culprit.
Steps to reproduce
In our case, we did as follows:
Update a user with an email already used and call save().
// user is an instance of Parse.User()
try {
user.email = 'alreadyInDb@test.com';
await user.save()
} catch (err) {
// We know there is an error but we never end up here because user's save() does not throw.
throw err;
}
Actual Outcome
Logs show an unhandled promise rejection, and nothing is caught in our catch block.
Expected Outcome
The SDK should catch the error and throw it back to the app.
Environment
nodejs 12.16.1
parse 3.3.0
parse-server 4.5.0
We were working with earlier versions of parse and parse-server before and updated to the latest versions to see if this error was fixed.
Server
Parse Server version: 4.5.0
Operating system: Google App Engine (some version of Linux)
Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Google Cloud
Database
System (MongoDB or Postgres): MongoDB
Database version: 4.4.6
Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): MongoDB Atlas
Client
Parse JS SDK version: 3.3.0
Logs
(node:10) UnhandledPromiseRejectionWarning: Error: Account already exists for this email address.
at /workspace/node_modules/parse/lib/node/ParseObject.js:3137:35
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:10) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 6)
(node:10) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
The text was updated successfully, but these errors were encountered:
New Issue Checklist
Issue Description
If an error is thrown by Parse-Server on a Parse.User.save(), the SDK does not catch it and an Unhandled Promise Rejection error is raised, making it impossible for our app to catch the error.
There may be some sort of wrapper I am not aware of, but I gave a quick look to the code and to the untrained eye, it simply looks as though there is no try-catch block in the save() method of ParseUser (
src/ParseUser.js
). Same goes for other methods likedestroy()
.According to logs, error is raised at ParseObject.js:3137, but the absence of ParseUser in the error stack gives me the feeling it is indeed the culprit.
Steps to reproduce
In our case, we did as follows:
Update a user with an email already used and call save().
Actual Outcome
Logs show an unhandled promise rejection, and nothing is caught in our catch block.
Expected Outcome
The SDK should catch the error and throw it back to the app.
Environment
nodejs 12.16.1
parse 3.3.0
parse-server 4.5.0
We were working with earlier versions of parse and parse-server before and updated to the latest versions to see if this error was fixed.
Server
4.5.0
Google App Engine (some version of Linux)
Google Cloud
Database
MongoDB
4.4.6
MongoDB Atlas
Client
3.3.0
Logs
The text was updated successfully, but these errors were encountered: