-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
fix: server crashes on MongoDB GeoJSON error instead of throwing Parse.Error #7347
base: alpha
Are you sure you want to change the base?
Conversation
Also added a corresponding test
Generated by 🚫 dangerJS |
Codecov Report
@@ Coverage Diff @@
## alpha #7347 +/- ##
==========================================
- Coverage 94.20% 94.19% -0.01%
==========================================
Files 182 182
Lines 13587 13590 +3
==========================================
+ Hits 12799 12801 +2
- Misses 788 789 +1
Continue to review full report at Codecov.
|
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.
Thanks for the PR! Let's wait for the new version of the SDK and we are good to merge this one.
testSchema.addIndex('geospatial_index', { | ||
geometry: '2dsphere', | ||
}); | ||
await testSchema.save(); |
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.
I want to make sure we don't introduce a flaky test here. This awaits the schema save, but not the index building in DB.
Maybe you want to look into schema tests to see what do we usually use in these cases, a timeout?
cc @dplewis
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.
The test is not flaky for me. The collection starts empty, so index building should take close to no time.
I couldn't find any tests for addIndex on the server codebase. The JS sdk has several, but none of them seem to explicitly wait on index-building.
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.
I think there is no way to verify index building via Parse, so the only way would be connecting directly to mongodb and checking the status. Or modify Parse adapter to include that. I believe this test will not be flaky but a timeout (maybe 1 or 2s) could be helpful as well.
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.
Ok then let's merge it as it is and see how it goes. I will run the tests a few times here to see whether its flaky already.
Modified an existing test to work with the new sdk release ParseUser.get('password') used to return undefined, now password is not an attribute
@davimacedo The PR now uses the latest SDK release, which includes the INVALID_VALUE error code |
|
@mstniy Do you think we could get this ready for merge? |
testSchema.addIndex('geospatial_index', { | ||
geometry: '2dsphere', | ||
}); | ||
await testSchema.save(); |
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.
I think there is no way to verify index building via Parse, so the only way would be connecting directly to mongodb and checking the status. Or modify Parse adapter to include that. I believe this test will not be flaky but a timeout (maybe 1 or 2s) could be helpful as well.
Thanks for opening this pull request!
|
@mstniy Could you rebase this on the alpha brach and resolve any conflicts? |
New Pull Request Checklist
Issue Description
Creating an object in a collection with a spatially indexed field fails if that field of the new object does not contain valid geometry. This is not handled by Parse, causing an INTERNAL_SERVER_ERROR that makes it difficult to diagnose invalid geojsons.
Related issue: #7331
Approach
Geojson errors produced by Mongo are cought and turned into Parse errors.
TODOs before merging