SkygearIO / py-skygear

Skygear Cloud Code Python SDK
https://skygear.io
Other
8 stars 20 forks source link

Not able to get record parameters in after save cloud function #161

Closed priyankaNav closed 7 years ago

priyankaNav commented 7 years ago

In the Code below am trying to read a record after save. Ideally the "record" should contain all the data that is been saved in previous step, but when i try to get record information i get none for all the fields except username.

@skygear.after_save('user', async=True) def update_user(record, original_record, db): if original_record is None: print( record.get("updatedBy")) print( record.get("ownerId")) print( record.get("createdBy")) r = requests.post("https://d3125f95.ngrok.io/insertuser", headers={ "Content-Type": "application/json" }, data=json.dumps({ "username": str(record.get("username")), "_id": str(record.get("_id") )})) print(r.text) return r

Expected Results

e1fdce23-cc21-4012-806c-3a31fa97cf2b e1fdce23-cc21-4012-806c-3a31fa97cf2b e1fdce23-cc21-4012-806c-3a31fa97cf2b efsdf

Actual Results

None None None efsdf

Steps to reproduce

  1. Add a Before save cloud function and after save cloud function in plugin.py of Py-skygear
  2. Login/signup from JS template configured with BaaS
chpapa commented 7 years ago

Answered at https://discuss.skygear.io/t/not-able-to-get-record-parameters-in-after-save-cloud-function/28/4