parse-server
parse-server copied to clipboard
fix: server crashes on MongoDB GeoJSON error instead of throwing Parse.Error
New Pull Request Checklist
- [ x] I am not disclosing a vulnerability.
- [ x] I am creating this PR in reference to an issue.
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
- [ x ] Add test cases
- [ ] Add entry to changelog
- [ ] Add changes to documentation (guides, repository pages, in-code descriptions)
- [ ] Add security check
- [ x ] Add new Parse Error codes to Parse JS SDK
- [ ] Depend on a release of the js sdk, instead of a commit hash.
| Warnings | |
|---|---|
| :warning: | Please add a changelog entry for your changes. |
Generated by :no_entry_sign: dangerJS
Codecov Report
Merging #7347 (ec1f80d) into alpha (8a126fc) will decrease coverage by
0.00%. The diff coverage is100.00%.
:exclamation: Current head ec1f80d differs from pull request most recent head 0301472. Consider uploading reports for the commit 0301472 to get more accurate results
@@ 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
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/Adapters/Storage/Mongo/MongoStorageAdapter.js | 93.41% <100.00%> (+0.25%) |
:arrow_up: |
| src/RestWrite.js | 93.88% <0.00%> (-0.32%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 8a126fc...0301472. Read the comment docs.
@davimacedo The PR now uses the latest SDK release, which includes the INVALID_VALUE error code
⚠️ Important change for merging PRs from Parse Server 5.0 onwards!
We are planning to release the first beta version of Parse Server 5.0 in October 2021.
If a PR contains a breaking change and is not merged before the beta release of Parse Server 5.0, it cannot be merged until the end of 2022. Instead it has to follow the Deprecation Policy and phase-in breaking changes to be merged during the course of 2022.
One of the most voiced community feedbacks was the demand for predictability in breaking changes to make it easy to upgrade Parse Server. We have made a first step towards this by introducing the Deprecation Policy in February 2021 that assists to phase-in breaking changes, giving developers time to adapt. We will follow-up with the introduction of Release Automation and a branch model that will allow breaking changes only with a new major release, scheduled for the beginning of each calendar year.
We understand that some PRs are a long time in the making and we very much appreciate your contribution. We want to make it easy for PRs that contain a breaking change and were created before the introduction of the Deprecation Policy. These PRs can be merged with a breaking change without being phased-in before the beta release of Parse Server 5.0. We are making this exception because we appreciate that this is a time of transition that requires additional effort from contributors to adapt. We encourage everyone to prepare their PRs until the end of September and account for review time and possible adaptions.
If a PR contains a breaking change and should be merged before the beta release, please mention @parse-community/server-maintenance and we will coordinate with you to merge the PR.
Thanks for your contribution and support during this transition to Parse Server release automation!
@mstniy Do you think we could get this ready for merge?
Thanks for opening this pull request!
- 🎉 We are excited about your hands-on contribution!
@mstniy Could you rebase this on the alpha brach and resolve any conflicts?