Skip to content

afterSave trigger is not working if the name of class is Message #4797

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

Closed
fhasni opened this issue May 30, 2018 · 3 comments
Closed

afterSave trigger is not working if the name of class is Message #4797

fhasni opened this issue May 30, 2018 · 3 comments

Comments

@fhasni
Copy link

fhasni commented May 30, 2018

Issue Description

afterSave trigger is not working if the name of class is Message

Steps to reproduce

  • Use a Message class
  • Define an afterSave trigger on Message class
  • save a Message object
var MESSAGE_CLASS = 'Message';
Parse.Cloud.afterSave(MESSAGE_CLASS, function(req) {
    console.log('---- AFTER SAVE RECORD', req);
});

Expected Results

What you expected to happen.
trigger run the same way if i used an other name of class like Post

Actual Outcome

An error is thrown, and the afterSave trigger not executed

Environment Setup

  • Server

    • parse-server version (Be specific! Don't say 'latest'.) : [FILL THIS OUT]
    • Operating System: macOS
    • Hardware: Macbook pro
    • Localhost
  • Database

    • MongoDB version: 3.2
    • Operating System: macOS
    • Hardware: Macbook pro
    • Localhost

Logs/Trace

warn: Making outgoing webhook request without webhookKey being set!
error: afterSave failed for Message for user G2YgGfjRJq:
  Input: {"body":"Hello","sender":{"__type":"Pointer","className":"_User","objectId":"G2YgGfjRJq"},"conversation":{"__type":"Pointer","className":"Conversation","objectId":"yA7ZPoTegl"},"createdAt":"2018-05-30T16:29:34.517Z","updatedAt":"2018-05-30T16:29:34.517Z","objectId":"AK6IoJApy3"}
  Error: {"code":141,"message":{}} className=Message, triggerType=afterSave, code=141, , user=G2YgGfjRJq
info: afterSave triggered for Message for user G2YgGfjRJq:
  Input: {"body":"Hello","sender":{"__type":"Pointer","className":"_User","objectId":"G2YgGfjRJq"},"conversation":{"__type":"Pointer","className":"Conversation","objectId":"yA7ZPoTegl"},"createdAt":"2018-05-30T16:29:34.517Z","updatedAt":"2018-05-30T16:29:34.517Z","objectId":"AK6IoJApy3"} className=Message, triggerType=afterSave, user=G2YgGfjRJq
warn: afterSave caught an error code=141, 
verbose: RESPONSE from [POST] /parse/classes/Message: {
  "status": 201,
  "response": {
    "objectId": "AK6IoJApy3",
    "createdAt": "2018-05-30T16:29:34.517Z"
  },
  "location": "http://localhost:1337/parse/classes/Message/AK6IoJApy3"
} status=201, objectId=AK6IoJApy3, createdAt=2018-05-30T16:29:34.517Z, location=http://localhost:1337/parse/classes/Message/AK6IoJApy3



@flovilmart
Copy link
Contributor

Looks like you have a webhook registered in your afterSave as well, what is this: Making outgoing webhook request without webhookKey being set!

@fhasni
Copy link
Author

fhasni commented Jun 3, 2018

I changed the name of class to ParseMessage and it works!, I think Message is predefined class!

@flovilmart
Copy link
Contributor

No, Message is not a predefined class. I believe you have a hook that you’re not aware of.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants