firebase / firebase-tools-ui

A local-first UI for Firebase Emulator Suite.
https://firebase.googleblog.com/2020/05/local-firebase-emulator-ui.html
Apache License 2.0
270 stars 62 forks source link

logs web viewer crashes while logging large objects #422

Open dkocich opened 3 years ago

dkocich commented 3 years ago

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 ?

yuchenshi commented 3 years ago

@abeisgoat for triaging.