Error 500 or error 502 most likely because of database error.
This happens mostly after update.
1. If you forgot to run the updater, please go to admin_panel_url.com (no /public).
It will open the updater page.
2. If still get error, open .env file on both admin panel and node server sides on the root, check if the database credentials are updated.
3. After that restart nodejs