firebase-tools-ui icon indicating copy to clipboard operation
firebase-tools-ui copied to clipboard

logs web viewer crashes while logging large objects

Open dkocich opened this issue 3 years ago • 1 comments

problem Sometimes when I accidentally log bigger objects somewhere in the code of a cloud function (or it has unsafe circular dependencies or something...) - e.g. like here with logger.info({ req, resp }, test); it causes that the log viewer of firebase emulator (http://localhost:4000/logs) ends in a broken state with a blank screen with this message in the browser's console:

react-dom.production.min.js:209 TypeError: Cannot read property 'mode' of undefined
    at HighlightedJSON.tsx:131
    at Array.map (<anonymous>)
    at Hr (HighlightedJSON.tsx:95)
    at Qo (react-dom.production.min.js:153)
    at ms (react-dom.production.min.js:261)
    at cu (react-dom.production.min.js:246)
    at su (react-dom.production.min.js:246)
    at Zs (react-dom.production.min.js:239)
    at react-dom.production.min.js:123
    at e.unstable_runWithPriority (scheduler.production.min.js:19)

possible solution I would appreciate seeing something more informative - the last thing that it tried to log to the UI (that caused the crash so I can remove it) or just fix of UI because this message is displayed correctly in the terminal (it just has like 50+ rows so it is completely unreadable :-) ) and I also see following logger.info() messages under it...

might help - https://www.npmjs.com/package/safe-json-stringify ?

dkocich avatar Nov 19 '20 14:11 dkocich

@abeisgoat for triaging.

yuchenshi avatar Nov 19 '20 18:11 yuchenshi