Hi everyone,
Since upgrading to Meteor 1.7 my error messages on the server side have been unreadable. This has made it incredibly hard to debug server-side methods.
Examples:
Exception while invoking method 'forms/review/generate_pdf' [object Object]
Exception while invoking method 'forms/updateByProgram' [object Object]
Exception while invoking method 'forms/createForm' [object Object]
Does anyone know how to fix this? It’s really hampering any ability to write code!
Cheers!
1 Like
Check your browser console to see the complete error
In the browser it just returns 500 server error; not the full value of the error
Try adding this inside Meteor.startup()
in your server
const originalMeteorDebug = Meteor._debug;
Meteor._debug = (message, stack) => {
if (Meteor.isDevelopment) {
console.log('===== message =====', message);
console.log('===== stack =====', stack);
}
return originalMeteorDebug.apply(this, arguments);
};
1 Like
@rjdavid Does not work!
The stack
received is [object Object]
.
Created an issue: https://github.com/meteor/meteor/issues/10078
1 Like
Thanks for this @rjdavid! I had to slightly modify your answer to get the log working with this. What I did was import util to unfurl the stack object and then fix it.
import util from 'util';
const originalMeteorDebug = Meteor._debug;
Meteor._debug = (message, stack) => {
if (Meteor.isDevelopment) {
console.log('===== message =====', message);
console.log('===== stack =====', stack);
console.log(util.inspect(stack, false, null))
}
return originalMeteorDebug.apply(this, arguments);
};
@s7dhansh - tell us if this works for you!
@MDG - hope this isn’t a permanent thing! It’s a huge thing not being able to debug server issues without a workaround.
2 Likes