General suggestions are of little use in the context of Strapi. People can look up what 502 means on the Internet.
Here, nobody is actually suggesting how to look up the webserver logs, which is like the most important thing in web development. With Strapi, you don’t have to manually start any web server, so where can you find the webserver’s logs?
To know where the some logs are, see my post: Where are the web server logs stored by default in Strapi 3.6.11?.
Anyway, I got this error in the past when I forgot to set some environment variables that are required by Strapi.