-
-
Notifications
You must be signed in to change notification settings - Fork 598
Open
Labels
type:bugImpaired feature or lacking behavior that is likely assumedImpaired feature or lacking behavior that is likely assumed
Description
New Issue Checklist
- I am not disclosing a vulnerability.
- I am not just asking a question.
- I have searched through existing issues.
- I can reproduce the issue with the latest versions of Parse Server and the Parse JS SDK.
Issue Description
Adding an afterSave
hook on the built-in _Role
class causes a validation error, even if the hook is completely empty and makes no changes to the object.
The error is:
A role's name can only be set before it has been saved.
This seems to be triggered due to internal behavior when handling _Role
objects during the afterSave
lifecycle. This bug prevents any post-save logic from being used with _Role
.
Steps to reproduce
- Add this Cloud Code to Parse:
Parse.Cloud.afterSave('_Role', async (request) => {
// no-op
});
- Run the following in your client or console:
const role = new Parse.Role('Admin', new Parse.ACL());
await role.save(); // fails
- Observe the validation error, even though no modification is made in the hook.
Actual Outcome
save()
fails with the following error:
A role's name can only be set before it has been saved.
Expected Outcome
Saving a _Role
with an empty afterSave
hook should succeed, as long as the name
field isn't modified.
Environment
Server
- Parse Server version:
8.1.0
- Operating system:
Ubuntu 22.04
- Local or remote host:
Remote (self-hosted, Docker)
Database
- System:
MongoDB
- Database version:
6.0.x
- Host:
MongoDB Atlas
Client
- "parse": "^6.1.1"
Logs
Set
VERBOSE=1
but the only error printed is:A role's name can only be set before it has been saved.
Metadata
Metadata
Assignees
Labels
type:bugImpaired feature or lacking behavior that is likely assumedImpaired feature or lacking behavior that is likely assumed