parse-community / parse-community/parse-server
customObjectId does not work with `beforeSave` triggers
Open
Nobody has claimed this yet.
type:bug
- Dominant language
- JavaScript
- Stars
- 21.4k
- Forks
- 4.8k
- Avg merge
- 7h 45m
- Merged PRs (30d)
- 11
Description
Issue Description
- customObjectId does not work with
beforeSavetriggers.
Steps to reproduce
- Turn on flag
allowCustomObjectIdon ParseServer - Try to create a
GameScoreobject with customObjectIdobjectId1(from Android or iOS) - Back to ParseServer, add
beforeSavetrigger forGameScorewith empty body / function. - Try to create the second
GameScoreobject with customObjectIdobjectId2(from Android or iOS)
Expected Results
- Received 2:
GameScoreobjects with customObjectId:objectId1,objectId2.
Actual Outcome
- The first object has
objectIdisobjectId1while the second object has random id like thissMTH8Sq6jl
Environment Setup
-
Server
- parse-server version: 4.2.0
- Operating System: N/A
- Hardware: N/A
- Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): The problem happens on both localhost and Heroku
-
Database
- MongoDB version: 4.2.7
- Storage engine: N/A
- Hardware: N/A
- Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): The problem happens on both localhost and mLab
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at Parse Server's handling of object creation with allowCustomObjectId enabled and compare it with the beforeSave trigger path; reproduce the two GameScore creations described. Done means both created objects retain objectId1 and objectId2 when an empty beforeSave trigger is enabled, with a regression test covering that sequence.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, mongodb, nodejs
- Domain
- api, backend, database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100