Self-hosting convex on domain with cloudflare
I'm running the convex open source backend, which works great locally. I wanted to expose it through a cloudflare tunnel on my custom domain name so I could access it from other devices, but when I expose port 3210 (which is what I saw being used in the just file) through a cloudflare tunnel to my domain at convex.---.com, and then replace the --url param with the new url, it doesn't work.
I see the following error from the
just convex dev
command (replaced my domain with ---)
I'm guessing it's because it needs a proxy URL set so it knows where to send API requests. Is there a way to fix this?14 Replies
I've never done this setup before, so you're breaking some new ground here. Seems like it should work.
Probably a good place to start is figuring out whether the request is getting to convex-backend or not. You can look at loglines from your
convex-local-backend
executable and see if it is receiving the prepare_schema
If I had to guess, it's probably the cloudflare tunnel that is returning the 405 - so you may want to check configuration there firstThanks, I just checked it. It looks like the convex-local-backend is actually receiving the requests, and returning a 405? Any idea what's causing this?
Here's the log. It keeps repeating this since the client is also trying to retry connecting.
if you contrast
with
you see that somehow the client's POST request is becoming a GET request by the time it gets to convex
i don't know why the cloudflare tunnel would change the method of the HTTP request 😕
It works perfectly for me with cloudflare tunnels
I didn't use just thought, I'll look at the justfile
Ah maybe it's because the use of http and not https
@Kiran can you make sure your url scheme is https
that worked, thanks so much!
Ofcourse
Do you know how self-hosted convex works when multiple devs connect to the same instance during development? Will the convex functions conflict and overwrite the other devs' code as they save, or does it use different device id's like the hosted convex version? (I know ideally devs should work on an isolated instance instead, but wanted to check how this works)
I'm not sure, I haven't done an actual project with convex yet, especially with another dev. Butttt if I had to guess it would work
Just a guess I really don't know
I would just test it
thanks, I'll try it out with 2 slightly modified projects at the same time and see what happens
on diff devices*
Let me know the results I'm curious
There's not much code related to teams on the rust side of things it seems atleast from what I seen
@ari probably knows
Hmmm
Convex | The fullstack TypeScript development platform
The backend application platform with everything you need to build your product.
Idk what this is but it seems related
This flow isn't supported, since you're correct that the two
npx convex dev
commands will compete with each other. I recommend having only one npx convex dev
running. You can still run two frontend servers (npm run dev:frontend
) connected to the same convex instancethanks, makes sense