-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
fix: invalid date in object causes unhandled promise rejection in beforeSave trigger #7193
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
base: alpha
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## alpha #7193 +/- ##
==========================================
+ Coverage 93.82% 94.13% +0.31%
==========================================
Files 182 182
Lines 13629 13635 +6
==========================================
+ Hits 12787 12835 +48
+ Misses 842 800 -42
Continue to review full report at Codecov.
|
Thanks for this PR. Can you please add a test case that covers the issue this PR intends to fix? |
I don't know how to add a test case that setup beforeSave on a class with Date. Can someone provide some pointers? |
Please look into the This would also be the code example that I asked for in the related issue. |
I still have no time to learn the test system. So I spent half an hour to setup a project to demo the bug |
Can you merge the latest commit of master? |
From your comment:
The error codes are not arbitrary, we have to pick the right one. As I commented in my PR, there may be an additional issue that we are getting two different error codes and messages for the same error. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please also add a CHANGELOG entry?
bb27d24
to
69d92f0
Compare
@mtrezza Changelog added |
Hello @mtrezza . I think I addressed everything. Let's merge it |
@mtrezza Have a look now |
Hello, can some one merge this? @mtrezza @ @dplewis @davimacedo |
@sunshineo Can you please merge the current master into it to make the tests pass? |
I just merged master into this branch. |
# [5.3.0-alpha.3](parse-community/parse-server@5.3.0-alpha.2...5.3.0-alpha.3) (2022-03-27) ### Features * add MongoDB 5.2 support ([parse-community#7894](parse-community#7894)) ([6b4b358](parse-community@6b4b358))
# [5.3.0-alpha.4](parse-community/parse-server@5.3.0-alpha.3...5.3.0-alpha.4) (2022-04-04) ### Bug Fixes * custom database options are not passed to MongoDB GridFS ([parse-community#7911](parse-community#7911)) ([a72b384](parse-community@a72b384))
# [5.3.0-alpha.5](parse-community/parse-server@5.3.0-alpha.4...5.3.0-alpha.5) (2022-04-09) ### Bug Fixes * security upgrade moment from 2.29.1 to 2.29.2 ([parse-community#7931](parse-community#7931)) ([6b68593](parse-community@6b68593))
# [5.3.0-alpha.6](parse-community/parse-server@5.3.0-alpha.5...5.3.0-alpha.6) (2022-04-11) ### Bug Fixes * peer dependency mismatch for GraphQL dependencies ([parse-community#7934](parse-community#7934)) ([b7a1d76](parse-community@b7a1d76))
# [5.3.0-alpha.7](parse-community/parse-server@5.3.0-alpha.6...5.3.0-alpha.7) (2022-04-25) ### Bug Fixes * security upgrade @parse/fs-files-adapter from 1.2.1 to 1.2.2 ([parse-community#7948](parse-community#7948)) ([20fc4e2](parse-community@20fc4e2))
I still seeing this in 5.0, whats going on looks like a simple fix... |
It seems the changes just need to be reviewed then we can release this as an alpha version. |
try { | ||
response['object'] = request.object._getSaveJSON(); | ||
} catch (error) { | ||
// https://github.com/parse-community/parse-server/issues/7192 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you pleas remove the comment, it's not necessary
try { | ||
parseObjectJSON = parseObject.toJSON(); | ||
} catch (error2) { | ||
// https://github.com/parse-community/parse-server/issues/7192 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove comment; I think also error2
is unused, so you could remove it as well?
Thanks for opening this pull request!
|
{ __type: 'Date', iso: 'invalidIsoDate' }, | ||
{ __type: 'Date', iso: '' }, | ||
]; | ||
for (const date of dates) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefer
await Promise.all(dates.map(async date => {
...
}));
59215e6
to
e6d7d8f
Compare
New Pull Request Checklist
Issue Description
Related issue: #7192
Approach
TODOs before merging