Repository navigation
customObjectId does not work with beforeSave triggers #6733
Description
Activity
I think inside PServer, It uses JS-SDK and in it, it is not yet implemented. parse-community/Parse-SDK-JS#1097
- addedtype:bugImpaired feature or lacking behavior that is likely assumedImpaired feature or lacking behavior that is likely assumed
on Jul 7, 2020 Any update on this? I am having same issue. I was saving custom object ids from express app, and it was working fine. And as soon as I add beforeSave trigger, it started discarding the provided custom ids, and stored objects with newly generated ids by parse.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I can confirm - we have the same issue
Same!
So i found the reason and a solution.
getResponseObjectcalls_getSaveJSONthis in turn removes the objectId.A simple solution would be to add this to the resolver of
getResponseObject. This fixes the issue - as it adds the id back if it is missing from modified object!if (triggerType === Types.beforeSave && config.allowCustomObjectId && parseObjectJson.objectId) { object.object.objectId = parseObjectJson.objectId }
another option would the to just remove
_getSaveJSONif allowCustomObjectId is set. This should be fine as this is not called if a before save trigger ist not set, so removing it will probably not have any side effects. Checking ensures that it would change stuff in cases where the current codebase is already broken.if (request.triggerName === Types.beforeSave && !config.allowCustomObjectId) { response['object'] = request.object._getSaveJSON(); }
It would be better if you could create a PR for this to further discuss this. @felix-ht
- added a commit that references this issue
on Feb 12, 2021 - added a commit that references this issue
on Feb 21, 2021 allowCustomObjectId has been added to the JS SDK and merged with the server.
I'll try to do a PR to fix this issue.
We countered the same issue and glad to know the bug fix has been merged. Any plans to release this fix in the soon future?
+1 - Any plans to release this fix in the soon future?
- added a commit that references this issue
on Nov 1, 2021 any update on this?
The first step would be to open a PR and demonstrate the issue with a failing test. From there, we can look for a fix.
- added a commit that references this issue
on Mar 14, 2022 - added a commit that references this issue
on May 19, 2022
Issue Description
beforeSavetriggers.Steps to reproduce
allowCustomObjectIdon ParseServerGameScoreobject with customObjectIdobjectId1(from Android or iOS)beforeSavetrigger forGameScorewith empty body / function.GameScoreobject with customObjectIdobjectId2(from Android or iOS)Expected Results
GameScoreobjects with customObjectId:objectId1,objectId2.Actual Outcome
objectIdisobjectId1while the second object has random id like thissMTH8Sq6jlEnvironment Setup
Server
Database