我正在尝试通过我的应用发送消息,但是我总是在heroku中收到此错误。这是错误:
这是api代码:https://github.com/devslopes-learn/mac-chat-api
api代码段
client.on('newMessage', function(messageBody, userId, channelId, userName, userAvatar, userAvatarColor) {
//Create message
console.log(messageBody);
let newMessage = new Message({
messageBody: messageBody,
userId: userId,
channelId: channelId,
userName: userName,
userAvatar: userAvatar,
userAvatarColor: userAvatarColor
});
//Save it to database
newMessage.save(function(msg){
//Send message to those connected in the room
console.log('new message sent');
io.emit("messageCreated", newMessage.messageBody, newMessage.userId, newMessage.channelId, newMessage.userName, newMessage.userAvatar, newMessage.userAvatarColor, newMessage.id, newMessage.timeStamp);
});
});