jedimonkeyJ
Convex Communityβ€’4mo agoβ€’
4 replies
jedimonkey

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

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 }


with client.onUpdate calls:

 client.onUpdate(
    api.analysis_requests.getRequestsByStatus,
    { params },
    callback
)
Was this page helpful?