Obsidian Headless Sync on Linux VPS gives ReferenceError: WebSocket is not defined though wss is not blocked

What I’m trying to do

Set up Obsidian headless sync on a DigitalOcean Linux VPS.

Things I have tried

I installed using “sudo npm install -g obsidian-headless”

Then I did “ob login” and I get below error:

ReferenceError: WebSocket is not defined

I checked that websocket is enabled on the machine doing the following:

“sudo npm install -g wscat”

And then“wscat -c wss” to echo websocket org

I get echo reply on any message I send.So seems like websocket isn’t restricted.

Any ideas?

WebSocket Headless Sync

You probably have a Node.js version that is too old. I ran into the same error, and the default version of Node.js in Debian 13 is 20, which doesn’t have the stable WebSocket API. I installed a newer version (24) and now it works fine.