Read the statement by Michael Teeuw here.
MMM-PGA
-
Anyone know how to fix this the error has to do with “athlete”??? Module is stuck on loading…
0|MagicMirror | MMM-PGA Retrieving Tounament List
0|MagicMirror | [12.06.2021 09:48.30.361] [LOG]
0|MagicMirror | MMM-PGA retrieving Tournament Data
0|MagicMirror | [12.06.2021 09:48.30.386] [ERROR]
0|MagicMirror | Whoops! There was an uncaught exception…
0|MagicMirror | [12.06.2021 09:48.30.388] [ERROR] TypeError: Cannot read property ‘athlete’ of undefined
0|MagicMirror | at Request._callback (/home/pi/MagicMirror/modules/MMM-PGA/ESPN.js:49:65)
0|MagicMirror | at Request.self.callback (/home/pi/MagicMirror/node_modules/request/request.js:185:22)
0|MagicMirror | at Request.emit (events.js:315:20)
0|MagicMirror | at Request. (/home/pi/MagicMirror/node_modules/request/request.js:1154:10)
0|MagicMirror | at Request.emit (events.js:315:20)
0|MagicMirror | at IncomingMessage. (/home/pi/MagicMirror/node_modules/request/request.js:1076:12)
0|MagicMirror | at Object.onceWrapper (events.js:421:28)
0|MagicMirror | at IncomingMessage.emit (events.js:327:22)
0|MagicMirror | at endReadableNT (_stream_readable.js:1220:12)
0|MagicMirror | at processTicksAndRejections (internal/process/task_queues.js:84:21) -
Anyone able to help as it seems the developer has abandoned the project…something to do with “athlete” in the json requests etc but idk where to start to fix that but willing to give it a shot with some direction. Thanks!
-
@swvalenti I don’t know, but you could
console.log(JSON.stringify(data,null,2))
(replace ‘data’ with the variable name of the response from the request)
to dump out the data u got back and examine the structure to see if it changed
if u have the exact URL, you usually can do this in a browser too… -
@sdetweil Not sure I follow Sam I am new to json
-
@cowboysdude @Mykle1 Calling on the big guns here if you have any ideas :face_with_tongue:
-
Can anyone explain or help me to try and get this module working again? Seems simple enough as ‘athlete’ is throwing the error but idk where to start.
-
@swvalenti as I said, u can use some tools in the coding to get the json data structure printed out so you can examine it
or, use the url in a browser to collect the info.
once u have that you can attempt to find the info the module needed
and maybe change the code to matchI use this site for validating json documents
https://codebeautify.org/jsonvalidator?/jsonvalidatebut it also allows you to format the data in a more readable fashion
the code is trying to extract the player from the data returned
Cannot read property ‘athlete’ of undefined
0|MagicMirror | at Request._callback (/home/pi/MagicMirror/modules/MMM-PGA/ESPN.js:49:65)the code is the ESPN.js line 45, column 65
u also may get noting back from the api at all…
-
@sdetweil Ok but which url do I use to check the json?
-
I just commented that line out and now it works! HA
-
@swvalenti the url used by the code to get the data from the api…
I don’t know the module at all, just trying to give some help.
Someone (You) will have to become the programmer.
learn how the module works in enough detail to :-
- find where the error occurs (this is given to you)
-
- develop some mechanism to capture the data that results in the failure
-
- analyze the data to determine the cause
-
- develop a strategy for fixing the ‘problem’
-
- apply the strategy to the existing code
repeat 1-5 til you have resolved the problem(s) successfully, or abandon the task
-