puzzle/marina-gui

[Bug] SyntaxError: JSON.parse: end of data after property value in object .. of the JSON data

gcomte opened this issue · 0 comments

We are suffering from a bug that makes Marina unusable from time to time. It looks like it would appear every time a new user logs into Marina for the first time. Probably there is something going wrong between Marina and Keycloak.

Error description
From time to time, the login process ends up in some kind of a redirect loop (probably when a new user logs in for the first time), which results in hundreds of accounts being stored in the Marina DB table employee. The request then somehow aborts, which causes further damage to the DB: the field amount_chf of the table current_configuration is left with the value NULL, which in turn breaks the JSON parsing, resulting in the appearance of the follwoing error in the front-end:
SyntaxError: JSON.parse: end of data after property value in object at line 1 column 128287 of the JSON data

Quick-fix recovery
Fix the DB as follows:

  1. Find your way into the terminal of the DB instance.
  2. psql (optional: \l to list databases)
  3. \c marina (optional: \dt to show tables)
  4. Analyze the problem: SELECT * FROM employee;
  5. DELETE FROM employee where brutto_salary IS NULL AND username = 'faulty_username';
  6. UPDATE current_configuration SET amount_chf = 0 where amount_chf IS NULL;