microbiomedata / nmdc-edge

Web-based interface to the NMDC EDGE platform
https://nmdc-edge.org
4 stars 0 forks source link

Logger logs `[object Object]` instead of error details #288

Closed eecavanna closed 2 months ago

eecavanna commented 2 months ago

Problematic line of code:

https://github.com/microbiomedata/nmdc-edge/blob/4b1d821d0ab0951b8d8420ea8f70f3fba09a1fd8/webapp/server/routes/auth-api/user.js#L513

This line prints [object Object] instead of the error details.

yxu-lanl commented 2 months ago

Don't know how to reproduce the error.

ssarrafan commented 2 months ago

@eecavanna can you help Yan with reproducing this error?

eecavanna commented 2 months ago

Hi @yxu-lanl, I want to clarify the issue. The issue is that the logger.error(err) statement on line 513 of user.js prints [object Object] instead of printing details about the error.

https://github.com/microbiomedata/nmdc-edge/blob/4b1d821d0ab0951b8d8420ea8f70f3fba09a1fd8/webapp/server/routes/auth-api/user.js#L506-L513

I am not too familiar with this endpoint. I think any conditions that cause line 513 to be reached will cause the issue to occur. I'll try modifying the endpoint code locally to guarantee that line 513 is reached (locally) and report back.

eecavanna commented 2 months ago

Hi @yxu-lanl, I created a PR containing a fix. Here's a link to the PR: https://github.com/microbiomedata/nmdc-edge/pull/297

To reproduce the error locally, I used a standalone HTTP client (e.g. Postman, Insomnia, Bruno—in my case, I used Bruno) instead of the NMDC EDGE web client; and then iteratively modified the problematic endpoint's code so that the various error conditions would arise.