I am trying to integrate Rocket chat to my application using asteroid but when I use Rocket.chat's LoadHistory method I get {isClientSafe: true, error: 400, reason: "Match failed", message: "Match failed [400]", errorType: "Meteor.Error"}. To be clear, I have never used Rocket.chat or Asteroid before. However some methods are working flawlessly.
/**
* Calls a server-side method with the specified arguments.
* @param method string required: the name of the method to call
* @param params [param1, param2, ...] any optional: parameters passed to the
server method
* @return Promise resolved, rejected
*/
let asteroidMethods = function (method, param){
return socket.call(method, param)
};
getMessageHistory = (lastMessage) => {
let param =[ lastMessage.rid, null, 50, lastMessage['ts']['$date']];
asteroidMethods("loadHistory", param).then(res=>{
console.log(res)
}).catch(e=>{
console.log(e)
})
}
Since the
Match failedresponse is a rather generic one, there're several potential issues causing your error. For example, thelastMessage.ridcould be empty.With your problem, the Rocket.Chat server logs shall give you more information about the underlaying problem. For that, Rocket.Chat offers a nice way of accessing the server logs through the user interface:
Log Levelto be very verbose -> Level2(https://example.com/admin/Logs)Example
I've set my
roomIdto42in an example request:That triggers the following log event with very detailed information:
With that information, you should be able to identify the actual issue behind your request.