Skip to content

TypeError: Cannot read property 'length' of undefined #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
zipzapp opened this issue Oct 19, 2017 · 4 comments
Closed

TypeError: Cannot read property 'length' of undefined #1

zipzapp opened this issue Oct 19, 2017 · 4 comments

Comments

@zipzapp
Copy link

zipzapp commented Oct 19, 2017

Hey there!

Tried giving your json log viewer a spin but I couldn't get it going.

some specs:
windows 10 x64
using git bash
node v8.7.0

$ jv logs/dev.log
TypeError: Cannot read property 'length' of undefined
    at len (C:\Users\JonathanCS\AppData\Local\Yarn\config\global\node_modules\json-log-viewer\src\utils.js:42:17)
    at padEnd (C:\Users\JonathanCS\AppData\Local\Yarn\config\global\node_modules\json-log-viewer\src\utils.js:50:28)
    at columns.map.column (C:\Users\JonathanCS\AppData\Local\Yarn\config\global\node_modules\json-log-viewer\src\utils.js:13:14)
    at Array.map (<anonymous>)
    at rows.map.row (C:\Users\JonathanCS\AppData\Local\Yarn\config\global\node_modules\json-log-viewer\src\utils.js:8:20)
    at Array.map (<anonymous>)
    at formatRows (C:\Users\JonathanCS\AppData\Local\Yarn\config\global\node_modules\json-log-viewer\src\utils.js:7:15)
    at MainPanel.update (C:\Users\JonathanCS\AppData\Local\Yarn\config\global\node_modules\json-log-viewer\src\widgets\MainPanel.js:440:21)
    at MainPanel.renderLines (C:\Users\JonathanCS\AppData\Local\Yarn\config\global\node_modules\json-log-viewer\src\widgets\MainPanel.js:92:10)
    at MainPanel.loadFile (C:\Users\JonathanCS\AppData\Local\Yarn\config\global\node_modules\json-log-viewer\src\widgets\MainPanel.js:39:10)
@fcoury
Copy link
Member

fcoury commented Dec 1, 2017

Hey @athaax I am not sure why but I don't receive GitHub notifications when a new Issue is added.

Do you mind posting your log file here?

@dgladbach
Copy link

Hey!
Same problem here.
Linux Mint 18.2
node v9.2.0

$jv censored.log
TypeError: Cannot read property 'length' of undefined
    at len (/usr/local/lib/node_modules/json-log-viewer/src/utils.js:42:17)
    at padEnd (/usr/local/lib/node_modules/json-log-viewer/src/utils.js:50:28)
    at columns.map.column (/usr/local/lib/node_modules/json-log-viewer/src/utils.js:13:14)
    at Array.map (<anonymous>)
    at rows.map.row (/usr/local/lib/node_modules/json-log-viewer/src/utils.js:8:20)
    at Array.map (<anonymous>)
    at formatRows (/usr/local/lib/node_modules/json-log-viewer/src/utils.js:7:15)
    at MainPanel.update (/usr/local/lib/node_modules/json-log-viewer/src/widgets/MainPanel.js:440:21)
    at MainPanel.renderLines (/usr/local/lib/node_modules/json-log-viewer/src/widgets/MainPanel.js:92:10)
    at MainPanel.loadFile (/usr/local/lib/node_modules/json-log-viewer/src/widgets/MainPanel.js:39:10)

My logfile is generated by Monolog and looks like this

{"message":"Matched route \"**_heartbeat_check\" (parameters: \"_controller\": \"**\\Controller\\**Controller::heartbeatCheckAction\", \"_route\": \"**_heartbeat_check\")","context":[],"level":200,"level_name":"INFO","channel":"request","datetime":{"date":"2017-12-06 09:23:42.253060","timezone_type":3,"timezone":"Europe/Berlin"},"extra":[]}
{"message":"Fatal Error: Call to a member function forceLogout() on null","context":{"type":1,"file":"/var/www/html/***BO.php","line":75,"level":-1,"stack":[{"function":"getAutoLogoutInfo","type":"->","class":"**\\BusinessObjects\\**BO","file":"/var/www/html/**Controller.php","line":28,"args":[]},{"function":"heartbeatCheckAction","type":"->","class":"**\\Controller\\**Controller","file":"/var/www/html/**/app/bootstrap.php.cache","line":3054,"args":[]}]},"level":600,"level_name":"EMERGENCY","channel":"php","datetime"{"date":"2017-12-06 09:23:42.434108","timezone_type":3,"timezone":"Europe/Berlin"},"extra":[]}

@fcoury
Copy link
Member

fcoury commented Dec 6, 2017

Thanks @dgladbach I'll work on it and let you know!

fcoury added a commit that referenced this issue Dec 6, 2017
fcoury added a commit that referenced this issue Dec 6, 2017
@fcoury
Copy link
Member

fcoury commented Dec 6, 2017

@dgladbach this should fix your issue.

Please also note that the second line on the log file you provided on your example isn't valid JSON:

JSON Linter Link

image

@fcoury fcoury closed this as completed in #2 Dec 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants