Colyseus Server Freezes On Error(solved)

Hello!
I am having big issues with my Colyseus server, when my server experiences an issue, it doesnt crash or keep going, it just freezes. If it crashed thats fine, i could use nodemon or pm2 to restart it and report the error, but it just hangs. Having 0 bugs is totally unrealistic. Only thing i can think of is wrap every piece of server code i write in a try {} catch (e) {} but that feels sketchy. Does anyone have a way to keep Colyseus running or have the process terminate on crash?

Thanks,
Mitch

Hi Mitch,

I've never seen this issue being reported, could you share more details about the environment you're running in?

E.g. are you using Windows? which Node.js version? How do you spawn the process? If you can provide a way we can reproduce would also be nice. Thanks

Hello,

Im on MacOS 11.6.1 and using Node 16.14.0

I actually fixed it by changing in package.json
"start": "ts-node-dev --respawn --transpile-only src/index.ts",
to:
"start": "ts-node --transpile-only src/index.ts",

Turns out the --respawn flag was making it hang upon an error.

I just had one of my colyseus message channels throw an error like this: "let b = c.d" where c is undefined.

Now if i could just get it to report errors to RayGun or Sentry upon crash that would be great - seems like a different thread though probably