You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So this one has been bugging me for awhile :). And I could use a little guidance on where to look for a good solution.
Sometimes, an error will result in a very unhelpful: [object Object] output on console.error.
So there's more than one problem here:
Stuff should be output on console.error. Users of parse-server should expect that errors will be output to the logger, not the console.
the error message is totally useless!
So I ran into this issue today and dug into it. I am part of the way there, but need some help to think through a better solution (or at least I need to put it on the back burner for now...)
I did determine where the output is coming from: the 'backstop' next() handler that is called at the end of an express request if 'something' isn't done to prevent it.
In my case, the error was due to a misconfigured s3 adapter. And I fixed this particular error with this change: #3424
But I KNOW that there are other places where the dreaded [object Object] output to console.error occurs and it would be good if we could put in a good backstop.
SOOOOO, I see that middleware.js gets called and before handing off the arguments to the final backstop in express.
with a nice TODO: // TODO: Add logging as those errors won't make it to the PromiseRouter
it would seem to me that three changes are needed to make a general solution that will allow us to remove that todo:
either extend Parse.Error (Parse.ServerError?) or add an optional param to Parse.Error so we can add the 'Source' with the source error that has caused the Parse.Error.
log the source error in middlewares.handleParseErrors
find all places where we new Parse.Error and add a source error if appropriate...
remove the next() from the end of the middlewares.handleParseErrors.
I'm game to do it, but want to make sure I am on the right track since I'm no express expert...yet :).
PS, it would also seem reasonable to redefine console.log, console.warn, console.error to logger.info....etc.?
The text was updated successfully, but these errors were encountered:
So this one has been bugging me for awhile :). And I could use a little guidance on where to look for a good solution.
Sometimes, an error will result in a very unhelpful:
[object Object]
output on console.error.So there's more than one problem here:
Stuff should be output on console.error. Users of parse-server should expect that errors will be output to the logger, not the console.
the error message is totally useless!
So I ran into this issue today and dug into it. I am part of the way there, but need some help to think through a better solution (or at least I need to put it on the back burner for now...)
I did determine where the output is coming from: the 'backstop' next() handler that is called at the end of an express request if 'something' isn't done to prevent it.
this calls this
In my case, the error was due to a misconfigured s3 adapter. And I fixed this particular error with this change: #3424
But I KNOW that there are other places where the dreaded
[object Object]
output to console.error occurs and it would be good if we could put in a good backstop.SOOOOO, I see that middleware.js gets called and before handing off the arguments to the final backstop in express.
with a nice TODO:
// TODO: Add logging as those errors won't make it to the PromiseRouter
it would seem to me that three changes are needed to make a general solution that will allow us to remove that todo:
either extend Parse.Error (Parse.ServerError?) or add an optional param to Parse.Error so we can add the 'Source' with the source error that has caused the Parse.Error.
log the source error in middlewares.handleParseErrors
find all places where we new Parse.Error and add a source error if appropriate...
remove the next() from the end of the middlewares.handleParseErrors.
I'm game to do it, but want to make sure I am on the right track since I'm no express expert...yet :).
PS, it would also seem reasonable to redefine console.log, console.warn, console.error to logger.info....etc.?
The text was updated successfully, but these errors were encountered: