Skip to content

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

@fhasni

Description

@fhasni

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



Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions