fresh icon indicating copy to clipboard operation
fresh copied to clipboard

PM2 doesn't seem to work with Fresh

Open jsb188 opened this issue 7 months ago • 8 comments

https://github.com/denoland/fresh/assets/9645145/b9b99264-561e-441e-94dd-4b9dacb23f9b

Related issue & better video: https://github.com/denoland/fresh/issues/2564

In this video, the app works. Half way through the video, I ran a command in terminal like this: deno task build && pm2 start main.ts --name=\"APP NAME\" --interpreter=\"deno\" --interpreter-args=\"run -A main.ts\" && pm2 save basically using PM2 to serve main.ts. That's when the app crashes.

Able to duplicate 100% by deploying a new build using PM2 to serve main.ts.

Cannot duplicate if deploying a new build WITHOUT PM2 to serve main.ts manually.

I cannot read deduce if this error is coming from Fresh, or a Socket.io or possibly my code, but reading the production minified code, I don't think it's my code. I could be wrong though.

I'd like to investigate this error more by deploying using PM2. the dev.ts file instead. But I can't, because serving dev.ts causes the browser to refresh on reconnect to $fresh. So I need some way to disable initial app refresh when dev.ts runs.

If someone understands why PM2 causes Deno Fresh to break, I'd like some input.

Update: This issue is not tied to PM2, serving the app without PM2 is equally a severe problem.

jsb188 avatar Jun 30 '24 11:06 jsb188