Jeidnx / untismerger

Node.js App designed to merge different time tables in untis together.
5 stars 0 forks source link

Cannot read sessionId #47

Open Jeidnx opened 2 years ago

Jeidnx commented 2 years ago

On the current devel version the server sometimes returns an Error: Cannot read properties of null (reading 'sessionId'). This error is thrown server side and is probably an issue with webuntis. Because this issue does not exist on the current main branch, misbehavior of the untis api can most likely be ruled out.

Additionally, if the client encounters this error before the first week is loaded, it crashes (if the error is encountered after the first week is loaded, the error gets caught fine). I couldn't yet figure out more details on this client side issue, because i only encountered it in the production build, which makes errors unreadable.

Jeidnx commented 2 years ago

i will look into what causes the server to throw the Issue when i have some spare time, probably tomorrow. As for the client side isssue i would really appreciate it if someone could try to reproduce this issue with a development build of next, to try and figure out what is going wrong. I would start by working out if the client only crashes on this error, or on all errors if the first week is not loaded.

Jeidnx commented 2 years ago

The Frontend part of this Issue is completely fixed with f81d780. For those wondering: If the second week loaded before the first week, the timetables Array had a value of [undefined, validTimetableData] because validTimetableData got inserted in position 1 and something has to be in position 0 for that to happen. Mapping this Array to timetableComponent feeds this undefined to timetableComponent which doesn't expect it and crashes.