502 error on server

@anish we were talking in this thread about my problem Cloudflare 522 error on custom server - #6 by bfrancisco

We haven’t touched any configuration or have done any deployment for the last week.

Here is my PM2 configuration:

module.exports = {
  name: "codotto.com",
  script: "index.js",
  args: "",
  log_type: "json",
  cwd: "/home/cleavr/codotto.com/artifact",
  // Note: We detected that this web app is running on a server with multiple CPUs and hence we are
  // setting *instances* to "max" and *exec_mode* to "cluster_mode" for better performance.
  instances : 1, // change the value to "1" if your server has only 1 CPU
  // exec_mode : "cluster_mode", // remove this line if your server has only 1 CPU
  env: {
    "PORT": 7145,
    "CI": 1,

Here are the logs for nginx

There is also a staging site, can you try deploying it?

@anish Sure. Will try now

@anish Deploying staging is completely fine. Production is still down

[EDIT] by “down” I mean taking a long time to install NPM packages and then just getting 502 error

@anish after redeploying it doesn’t look like that there is any node process listening on the correct port

This is my pm2 list output

I have tried re-deploying things several times but no luck. The server takes a long time in Installing npm packages but in the end I keep getting 502. Any ideas?

Hello @bfrancisco,

I’m taking a closer look at the issue right now. I’ll get back to you as soon as I find the cause of the issue.

The log says: Error: Cannot find module '/home/cleavr/example.com/current/index.js'

Thank you for understanding.

@anish thank you for taking a look into it. I really appreciate it.

I will not try to debug anymore so I don’t get in your way. I will be in standby and waiting for your answer. Thank you

Can you check the site now? It was deployed successfully.

@anish Seems like its working. What was the problem?

I will try to re-deploy again to make sure things are working correctly

@anish did you forget about answering this thread?

Dear @bfrancisco,

We apologize for the inconvenience.

We believe the issue was due to PM2 not updating correctly. Are you still encountering the same problem? We were unable to replicate the issue on our end and we would appreciate further information on how you encountered it.

If you need any assistance or have any other queries, please do not hesitate to reach out.

@anish Thanks for getting back.

As described before, the issue happened out of nowhere. We haven’t deployed anything new for 2 weeks. No configurations were changed - in fact, I hadn’t even logged in to cleavr in two weeks prior to the issue happening.

As you can understand this is an issue that happened in our production system and I haven’t got any email notifying me of the issue. This was found by one of our dearest customer and he notified us of the issue.

In case any other issue related to this happens again (without us doing any re-deployment or touching the configuration in Cleavr), we will have to cancel our account as we are growing and we can’t afford to have our production system going down like that.

I hope you can understand. In case I can help you further, please, let me know. I would love together to find solutions to our problems and avoid this situation from happening again.