-
-
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
.save() doesn't trigger beforeSave and afterSave #1031
Comments
Did you check in the database if the property was set? |
Yes, i checked, the property is not set in the db |
I have some more details:
Hope it helps. |
Check on the PR I just posted, I was working in this area, added a test with creating an object in a cloud function that gets updates by a beforeSave trigger and the returned object is properly set now. |
Hi @flovilmart, I'm a little late but it's still not working on:
Same result as my first post :( |
I'm not able to reproduce this. Something else must be wrong. Is there anything else in your cloud code file? > parse-server-example@1.4.0 start /Users/fjm/git/parse-server-example
> node index.js
DATABASE_URI not specified, falling back to localhost.
parse-server-example running on port 1337.
Parse LiveQuery Server starts running
test function called
[beforeSave] object: { name: 'testtesttest' }
[afterSave] object: { createdAt: '2016-03-22T20:52:19.976Z',
name: 'testtesttest',
surname: 'this is not saved',
updatedAt: '2016-03-22T20:52:19.976Z',
objectId: 'C10ysqMDpf' } |
I just fixed an issue in a // request.object.get('foo') === 'bar'
request.object.set('foo', 'baz')
response.success(request.object) but I wasn't seeing Changing the code to request.object.set('foo', 'baz')
response.success() where nothing gets passed into the |
@brandly that's the correct method, just calling success(). |
@gfosco I'm dumb. Thank you all :) |
Hello everyone,
first of all thank you for releasing parse-server!
Now on the issue:
Attributes changed on
beforeSave
are still not updated, even on Parse >= 2.1.5.When you call save() on an object on parse-server then beforeSave and afterSave are not triggered.
Environment Setup
Steps to reproduce
Just create a test class called
TestClass
, put the following code in you parse-server main module and call thetest
endpoint:Logs/Trace
beforeSave and afterSave are not called.
Parse-server console output:
Client that called the
test
function result:If you create a new TestClass object by calling the classes/TestClass endpoint (e.g.: http://localhost:1337/parse/classes/TestClass) beforeSave and afterSave are triggered correctly:
Parse-server console output:
API call result:
The text was updated successfully, but these errors were encountered: