rdcore icon indicating copy to clipboard operation
rdcore copied to clipboard

500 errors in dashboard users-items.json

Open mrtshoot opened this issue 2 months ago • 4 comments

Description

Multiple dashboard endpoints return 500 Internal Server Error

Environment

  • RADIUSdesk Version: cake4 branch
  • PHP Version: 8.1+/8.2+
  • CakePHP Version: 4.5.x
  • Database: MariaDB/MySQL
  • Web Server: NGINX + PHP-FPM

Error

GET https://*****/cake4/rd_cake/dashboard/users-items.json?…=1&start=0&limit=25&token=676256d5-227c-4d32-a753-1eb1602a942b&cloud_id=24 500 (Internal Server Error)

app.js?_dc=20251022050244:1 Uncaught TypeError: Cannot read properties of undefined (reading 'message') at ctor.load (app.js?_dc=20251022050244:1:3417715) at ctor.fire (app.js?_dc=20251022050244:1:182101) at ctor.doFireEvent (app.js?_dc=20251022050244:1:189611) at b.doFireEvent (app.js?_dc=20251022050244:1:523480) at ctor.fireEventArgs (app.js?_dc=20251022050244:1:188513) at ctor.fireEvent (app.js?_dc=20251022050244:1:188242) at ctor.onProxyLoad (app.js?_dc=20251022050244:1:782812) at ctor.triggerCallbacks (app.js?_dc=20251022050244:1:702237) at ctor.setCompleted (app.js?_dc=20251022050244:1:701890) at ctor.setException (app.js?_dc=20251022050244:1:702148)

mrtshoot avatar Oct 26 '25 09:10 mrtshoot

Please review and check this PR. It is fixed on my server.

  1. admin_state column does NOT exist in the permanent_users
  2. The 500 error in users-items.json API endpoint was caused by undefined array access when checking component permissions.

Thanks https://github.com/RADIUSdesk/rdcore/pull/119

mrtshoot avatar Oct 26 '25 09:10 mrtshoot

Faced this exact issue with two brand new installs as well.

valhallen282 avatar Oct 27 '25 04:10 valhallen282

Does anybody knows how to resolve this issue?

UmamamheshwariS avatar Nov 20 '25 05:11 UmamamheshwariS

i'all facing the same issue in 2 different system Does anybody help me in resolving this issue app.js?_dc=20251111062317:1 GET http://45.112.21.251/cake4/rd_cake/dashboard/users-items.json?_dc=1763623337324&page=1&start=0&limit=25&token=b4c6ac81-8c7c-4802-b50a-0a6380555b50&cloud_id=23 500 (Internal Server Error) start @ app.js?_dc=20251111062317:1 request @ app.js?_dc=20251111062317:1 sendRequest @ app.js?_dc=20251111062317:1 doRequest @ app.js?_dc=20251111062317:1 read @ app.js?_dc=20251111062317:1 doExecute @ app.js?_dc=20251111062317:1 execute @ app.js?_dc=20251111062317:1 flushLoad @ app.js?_dc=20251111062317:1 (anonymous) @ app.js?_dc=20251111062317:1 elevate @ app.js?_dc=20251111062317:1 d @ app.js?_dc=20251111062317:1 setTimeout (anonymous) @ app.js?_dc=20251111062317:1 load @ app.js?_dc=20251111062317:1 updateAutoLoad @ app.js?_dc=20251111062317:1 b @ app.js?_dc=20251111062317:1 configure @ app.js?_dc=20251111062317:1 initConfig @ app.js?_dc=20251111062317:1 constructor @ app.js?_dc=20251111062317:1 constructor @ app.js?_dc=20251111062317:1 constructor @ app.js?_dc=20251111062317:1 constructor @ app.js?_dc=20251111062317:1 ctor @ app.js?_dc=20251111062317:1 eval @ VM110:3 create @ app.js?_dc=20251111062317:1 actionIndex @ app.js?_dc=20251111062317:1 runAction @ app.js?_dc=20251111062317:1 treeNodeSelect @ app.js?_dc=20251111062317:1 fire @ app.js?_dc=20251111062317:1 dispatch @ app.js?_dc=20251111062317:1 callParent @ app.js?_dc=20251111062317:1 dispatch @ app.js?_dc=20251111062317:1 (anonymous) @ app.js?_dc=20251111062317:1 fireEventArgs @ app.js?_dc=20251111062317:1 fireEvent @ app.js?_dc=20251111062317:1 updateSelection @ app.js?_dc=20251111062317:1 b @ app.js?_dc=20251111062317:1 onClick @ app.js?_dc=20251111062317:1 onClick @ app.js?_dc=20251111062317:1 click @ app.js?_dc=20251111062317:1 fire @ app.js?_dc=20251111062317:1 fire @ app.js?_dc=20251111062317:1 publish @ app.js?_dc=20251111062317:1 publishDelegatedDomEvent @ app.js?_dc=20251111062317:1 doDelegatedEvent @ app.js?_dc=20251111062317:1 onDelegatedEvent @ app.js?_dc=20251111062317:1Understand this error app.js?_dc=20251111062317:1 Uncaught TypeError: Cannot read properties of undefined (reading 'message') at ctor.load (app.js?_dc=20251111062317:1:3426071) at ctor.fire (app.js?_dc=20251111062317:1:182101) at ctor.doFireEvent (app.js?_dc=20251111062317:1:189611) at ctor.doFireEvent (app.js?_dc=20251111062317:1:523480) at ctor.fireEventArgs (app.js?_dc=20251111062317:1:188513) at ctor.fireEvent (app.js?_dc=20251111062317:1:188242) at ctor.onProxyLoad (app.js?_dc=20251111062317:1:782812) at ctor.triggerCallbacks (app.js?_dc=20251111062317:1:702237) at ctor.setCompleted (app.js?_dc=20251111062317:1:701890) at ctor.setException (app.js?_dc=20251111062317:1:702148) load @ app.js?_dc=20251111062317:1 fire @ app.js?_dc=20251111062317:1 doFireEvent @ app.js?_dc=20251111062317:1 (anonymous) @ app.js?_dc=20251111062317:1 fireEventArgs @ app.js?_dc=20251111062317:1 fireEvent @ app.js?_dc=20251111062317:1 onProxyLoad @ app.js?_dc=20251111062317:1 triggerCallbacks @ app.js?_dc=20251111062317:1 setCompleted @ app.js?_dc=20251111062317:1 setException @ app.js?_dc=20251111062317:1 setException @ app.js?_dc=20251111062317:1 processResponse @ app.js?_dc=20251111062317:1 (anonymous) @ app.js?_dc=20251111062317:1 callback @ app.js?_dc=20251111062317:1 onComplete @ app.js?_dc=20251111062317:1 onStateChange @ app.js?_dc=20251111062317:1 (anonymous) @ app.js?_dc=20251111062317:1 elevate @ app.js?_dc=20251111062317:1 (anonymous) @ app.js?_dc=20251111062317:1 XMLHttpRequest.send start @ app.js?_dc=20251111062317:1 request @ app.js?_dc=20251111062317:1 sendRequest @ app.js?_dc=20251111062317:1 doRequest @ app.js?_dc=20251111062317:1 read @ app.js?_dc=20251111062317:1 doExecute @ app.js?_dc=20251111062317:1 execute @ app.js?_dc=20251111062317:1 flushLoad @ app.js?_dc=20251111062317:1 (anonymous) @ app.js?_dc=20251111062317:1 elevate @ app.js?_dc=20251111062317:1 d @ app.js?_dc=20251111062317:1 setTimeout (anonymous) @ app.js?_dc=20251111062317:1 load @ app.js?_dc=20251111062317:1 updateAutoLoad @ app.js?_dc=20251111062317:1 b @ app.js?_dc=20251111062317:1 configure @ app.js?_dc=20251111062317:1 initConfig @ app.js?_dc=20251111062317:1 constructor @ app.js?_dc=20251111062317:1 constructor @ app.js?_dc=20251111062317:1 constructor @ app.js?_dc=20251111062317:1 constructor @ app.js?_dc=20251111062317:1 ctor @ app.js?_dc=20251111062317:1 eval @ VM110:3 create @ app.js?_dc=20251111062317:1 actionIndex @ app.js?_dc=20251111062317:1 runAction @ app.js?_dc=20251111062317:1 treeNodeSelect @ app.js?_dc=20251111062317:1 fire @ app.js?_dc=20251111062317:1 dispatch @ app.js?_dc=20251111062317:1 callParent @ app.js?_dc=20251111062317:1 dispatch @ app.js?_dc=20251111062317:1 (anonymous) @ app.js?_dc=20251111062317:1 fireEventArgs @ app.js?_dc=20251111062317:1 fireEvent @ app.js?_dc=20251111062317:1 updateSelection @ app.js?_dc=20251111062317:1 b @ app.js?_dc=20251111062317:1 onClick @ app.js?_dc=20251111062317:1 onClick @ app.js?_dc=20251111062317:1 click @ app.js?_dc=20251111062317:1 fire @ app.js?_dc=20251111062317:1 fire @ app.js?_dc=20251111062317:1 publish @ app.js?_dc=20251111062317:1 publishDelegatedDomEvent @ app.js?_dc=20251111062317:1 doDelegatedEvent @ app.js?_dc=20251111062317:1 onDelegatedEvent @ app.js?_dc=20251111062317:1Understand this error app.js?_dc=20251111062317:1 CLICK SELECTION 23 RADIUS app.js?_dc=20251111062317:1 CLICK SELECTION 23 NETWORK app.js?_dc=20251111062317:1 CLICK SELECTION 23 OTHER app.js?_dc=20251111062317:1 GET http://45.112.21.251/cake4/rd_cake/dashboard/other-items.json?_dc=1763623345335&page=1&start=0&limit=25&token=b4c6ac81-8c7c-4802-b50a-0a6380555b50&cloud_id=23 500 (Internal Server Error) start @ app.js?_dc=20251111062317:1 request @ app.js?_dc=20251111062317:1 sendRequest @ app.js?_dc=20251111062317:1 doRequest @ app.js?_dc=20251111062317:1 read @ app.js?_dc=20251111062317:1 doExecute @ app.js?_dc=20251111062317:1 execute @ app.js?_dc=20251111062317:1 flushLoad @ app.js?_dc=20251111062317:1 (anonymous) @ app.js?_dc=20251111062317:1 elevate @ app.js?_dc=20251111062317:1 d @ app.js?_dc=20251111062317:1 setTimeout (anonymous) @ app.js?_dc=20251111062317:1 load @ app.js?_dc=20251111062317:1 updateAutoLoad @ app.js?_dc=20251111062317:1 b @ app.js?_dc=20251111062317:1 configure @ app.js?_dc=20251111062317:1 initConfig @ app.js?_dc=20251111062317:1 constructor @ app.js?_dc=20251111062317:1 constructor @ app.js?_dc=20251111062317:1 constructor @ app.js?_dc=20251111062317:1 constructor @ app.js?_dc=20251111062317:1 ctor @ app.js?_dc=20251111062317:1 eval @ VM110:3 create @ app.js?_dc=20251111062317:1 actionIndex @ app.js?_dc=20251111062317:1 runAction @ app.js?_dc=20251111062317:1 treeNodeSelect @ app.js?_dc=20251111062317:1 fire @ app.js?_dc=20251111062317:1 dispatch @ app.js?_dc=20251111062317:1 callParent @ app.js?_dc=20251111062317:1 dispatch @ app.js?_dc=20251111062317:1 (anonymous) @ app.js?_dc=20251111062317:1 fireEventArgs @ app.js?_dc=20251111062317:1 fireEvent @ app.js?_dc=20251111062317:1 updateSelection @ app.js?_dc=20251111062317:1 b @ app.js?_dc=20251111062317:1 onClick @ app.js?_dc=20251111062317:1 onClick @ app.js?_dc=20251111062317:1 fire @ app.js?_dc=20251111062317:1 fire @ app.js?_dc=20251111062317:1 publish @ app.js?_dc=20251111062317:1 publishDelegatedDomEvent @ app.js?_dc=20251111062317:1 doDelegatedEvent @ app.js?_dc=20251111062317:1 onDelegatedEvent @ app.js?_dc=20251111062317:1Understand this error app.js?_dc=20251111062317:1 Uncaught TypeError: Cannot read properties of undefined (reading 'message') at ctor.load (app.js?_dc=20251111062317:1:3418377) at ctor.fire (app.js?_dc=20251111062317:1:182101) at ctor.doFireEvent (app.js?_dc=20251111062317:1:189611) at ctor.doFireEvent (app.js?_dc=20251111062317:1:523480) at ctor.fireEventArgs (app.js?_dc=20251111062317:1:188513) at ctor.fireEvent (app.js?_dc=20251111062317:1:188242) at ctor.onProxyLoad (app.js?_dc=20251111062317:1:782812) at ctor.triggerCallbacks (app.js?_dc=20251111062317:1:702237) at ctor.setCompleted (app.js?_dc=20251111062317:1:701890) at ctor.setException (app.js?_dc=20251111062317:1:702148)

UmamamheshwariS avatar Nov 20 '25 07:11 UmamamheshwariS

does anyone fixed the problem? Failed to load resource: the server responded with a status of 500 (Internal Server Error)

app.js?_dc=20251126114538:1 Uncaught TypeError: Cannot read properties of undefined (reading 'message') at ctor.load (app.js?_dc=20251126114538:1:3439260) at ctor.fire (app.js?_dc=20251126114538:1:182101) at ctor.doFireEvent (app.js?_dc=20251126114538:1:189611) at ctor.doFireEvent (app.js?_dc=20251126114538:1:523480) at ctor.fireEventArgs (app.js?_dc=20251126114538:1:188513) at ctor.fireEvent (app.js?_dc=20251126114538:1:188242) at ctor.onProxyLoad (app.js?_dc=20251126114538:1:782812) at ctor.triggerCallbacks (app.js?_dc=20251126114538:1:702237) at ctor.setCompleted (app.js?_dc=20251126114538:1:701890) at ctor.setException (app.js?_dc=20251126114538:1:702148) 

hasiniaina7 avatar Nov 29 '25 04:11 hasiniaina7

@mrtshoot @valhallen282 @UmamamheshwariS @dirkvanderwalt

### Fix for `/dashboard/users-items.json` 500 error and blank Users view (Ubuntu 24.04)

I ran into the same problem and managed to fix it. Here is what worked for me.

---

### Environment

- Ubuntu 24.04  
- Nginx + php-fpm 8.3  
- MariaDB (installed according to the official Ubuntu 24.04 guide)  
- `rdcore` + `cake4` cloned from GitHub  
- Database created with `rd.sql` as described in the docs:

```bash
mysql -u root
CREATE DATABASE rd;
GRANT ALL PRIVILEGES ON rd.* TO 'rd'@'127.0.0.1' IDENTIFIED BY 'rd';
GRANT ALL PRIVILEGES ON rd.* TO 'rd'@'localhost' IDENTIFIED BY 'rd';
exit;

mysql -u root rd < /var/www/rdcore/cake4/rd_cake/setup/db/rd.sql

Symptoms

  • The Users view in the web UI stays blank.
  • In the browser dev tools console:
GET /cake4/rd_cake/dashboard/users-items.json?... 500 (Internal Server Error)
Uncaught TypeError: Cannot read properties of undefined (reading 'message') in app.js
  • In cake4/rd_cake/logs/error.log, errors like:
SQLSTATE[42S22]: Column not found: 1054 Unknown column ...
#0 ... Database/Statement/MysqlStatement.php
#1 ... ORM/Query.php
#2 ... Controller/DashboardController.php ...

So /dashboard/users-items.json was returning HTTP 500 because some columns used in the Dashboard / Counts code did not exist in my DB schema.


Root cause

I had only loaded rd.sql.

In cake4/rd_cake/setup/db/ there are many incremental SQL patch files:

8.058_add_opt_in_for_ctc.sql
8.059_add_dynamic_detail_ctcs.sql
...
8.108_add_vpn_connections.sql

Some of the columns used by the Dashboard / Counts components are created in these 8.xx patch files.

Because I had not applied them, MariaDB threw SQLSTATE[42S22] Column not found, and the API /dashboard/users-items.json failed with HTTP 500, which in turn broke the ExtJS front-end.


Fix

1. Backup the database

Highly recommended before changing anything:

mysqldump -u root -p rd > /root/rd_backup_$(date +%F).sql

(remove -p if your MariaDB root user has no password)

2. Apply all SQL patch files in order

From the server:

cd /var/www/rdcore/cake4/rd_cake/setup/db

for f in $(ls 8.*.sql | sort -V); do
    echo "=== Applying $f ==="
    mysql -u root rd < "$f"
done
  • Add -p after root if your MariaDB root user has a password.
  • sort -V ensures the patches are applied in numeric order (8.058, 8.059, …, 8.108).

If a patch complains about duplicate columns or keys, it usually means that patch was already applied before (for example if you upgraded from an older installation).

3. Clear CakePHP model cache

As recommended in the docs when changing the schema:

cd /var/www/rdcore/cake4/rd_cake/tmp/cache/models
rm -f *

4. Restart PHP-FPM and reload Nginx

systemctl restart php8.3-fpm
systemctl reload nginx

Result

After applying all 8.xx SQL patches and clearing the model cache:

  • GET /cake4/rd_cake/dashboard/users-items.json?... returns valid JSON instead of HTTP 500.
  • The Users dashboard view loads correctly.
  • The ExtJS error Cannot read properties of undefined (reading 'message') disappears because the API now returns the expected structure.

Hopefully this helps anyone who followed the Ubuntu 24.04 installation guide, loaded only rd.sql, and then saw /dashboard/users-items.json failing with SQL 42S22 errors and a blank Users page.

::contentReference[oaicite:0]{index=0}

hasiniaina7 avatar Nov 29 '25 05:11 hasiniaina7