jedimonkey
jedimonkey2d ago

connecting to convex via node daemon

So this possibly sounds backwards, but I've written a daemon that connects to the convex ecosystem. The main reason why is it's dealing with largish files and I was learning convex at the time, so wasn't sure whether I wanted to port it to the convex backend. It's been working fine, but due to another project, I've not touched it for a couple of weeks. So back to it and I'm having trouble with the service connecting to convex. I've been using convex/browser which has been working fine and I've got it running on remote linux servers with prod currently fine. But dev, just refuses to connect:
connecting to https://my-dev-292.convex.cloud
Starting visualisation request service... [development]
Initializing listeners...
Service started. Press Ctrl+C to shut down.
WebSocket error message: Received network error or non-101 status code.
WebSocket closed with code 1002: Received network error or non-101 status code.
Attempting reconnect in 919ms
WebSocket error message: Received network error or non-101 status code.
WebSocket closed with code 1002: Received network error or non-101 status code.
Attempting reconnect in 2170ms
connecting to https://my-dev-292.convex.cloud
Starting visualisation request service... [development]
Initializing listeners...
Service started. Press Ctrl+C to shut down.
WebSocket error message: Received network error or non-101 status code.
WebSocket closed with code 1002: Received network error or non-101 status code.
Attempting reconnect in 919ms
WebSocket error message: Received network error or non-101 status code.
WebSocket closed with code 1002: Received network error or non-101 status code.
Attempting reconnect in 2170ms
It should give me another message if there was a successful connection, so I know it's definitely not connecting at all. The way I'm connecting is:
import './env'

import { ConvexClient } from 'convex/browser'

const convexUrl = process.env.CONVEX_URL
if (!convexUrl) {
throw new Error('CONVEX_URL environment variable is not set.')
}

console.log('connecting to ', convexUrl)
const client = new ConvexClient(convexUrl)
export { client }
import './env'

import { ConvexClient } from 'convex/browser'

const convexUrl = process.env.CONVEX_URL
if (!convexUrl) {
throw new Error('CONVEX_URL environment variable is not set.')
}

console.log('connecting to ', convexUrl)
const client = new ConvexClient(convexUrl)
export { client }
with client.onUpdate calls:
client.onUpdate(
api.analysis_requests.getRequestsByStatus,
{ params },
callback
)
client.onUpdate(
api.analysis_requests.getRequestsByStatus,
{ params },
callback
)
2 Replies
Convex Bot
Convex Bot2d ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!
jedimonkey
jedimonkeyOP2d ago
Also added verbose logging and I get this:
025-09-22T08:30:30.453Z constructed WebSocket
2025-09-22T08:30:30.458Z socket state changed: connecting, paused: no
2025-09-22T08:30:30.459Z message not sent (socket state: connecting, paused: no): {"type":"ModifyQuerySet"}
Starting visualisation request service... [development]
Initializing listeners...
2025-09-22T08:30:30.759Z message not sent (socket state: connecting, paused: no): {"type":"ModifyQuerySet"}
2025-09-22T08:30:30.759Z message not sent (socket state: connecting, paused: no): {"type":"ModifyQuerySet"}
Service started. Press Ctrl+C to shut down.
025-09-22T08:30:30.453Z constructed WebSocket
2025-09-22T08:30:30.458Z socket state changed: connecting, paused: no
2025-09-22T08:30:30.459Z message not sent (socket state: connecting, paused: no): {"type":"ModifyQuerySet"}
Starting visualisation request service... [development]
Initializing listeners...
2025-09-22T08:30:30.759Z message not sent (socket state: connecting, paused: no): {"type":"ModifyQuerySet"}
2025-09-22T08:30:30.759Z message not sent (socket state: connecting, paused: no): {"type":"ModifyQuerySet"}
Service started. Press Ctrl+C to shut down.
Has something changed that could be affecting this? I did notice the DDoS attack a couple of days ago - maybe this is linked? I've also verified on a different network, so don't think it's a network issue. This is from my mac, which can connect via a browser fine. Looks like this is related to a node version issue - v18 works okay, but anything above that fails to connect.

Did you find this page helpful?