I recently ran into the case where one of my apps had stopped and when i tried to restart it said it was started and showed the name and port, etc. However it was not actually running when re-running pod list. This led me to dig through the code a bit and I found that in api.startApp(), pm2.start() was indeed called and successfully returned the proper response that i was seeing. This means that most likely the pm2.start() method does not handle the case that I was seeing. I then decided to investigate the app within the pm2 scope. So I ran pm2 status which showed that my app was indeed stopped and when running pod start myapp and checking pm2 status again it was still stopped. The only way I could find around this was to run pm2 delete myapp and then re-run pod start myapp. After this It seemed to work just fine.
Im not entirely sure of this but In order to fix this perhaps you could get the status of the app from pm2 before running start, and if it is stopped then delete it from pm2, and proceed.
I recently ran into the case where one of my apps had stopped and when i tried to restart it said it was started and showed the name and port, etc. However it was not actually running when re-running
pod list. This led me to dig through the code a bit and I found that inapi.startApp(),pm2.start()was indeed called and successfully returned the proper response that i was seeing. This means that most likely thepm2.start()method does not handle the case that I was seeing. I then decided to investigate the app within the pm2 scope. So I ranpm2 statuswhich showed that my app was indeed stopped and when runningpod start myappand checkingpm2 statusagain it was still stopped. The only way I could find around this was to runpm2 delete myappand then re-runpod start myapp. After this It seemed to work just fine.Im not entirely sure of this but In order to fix this perhaps you could get the status of the app from pm2 before running start, and if it is stopped then delete it from pm2, and proceed.