Can't host Convex on Railway
vmoraes424
FREEOP

8 months ago

Hello! I have my sideproject that I wanted to host on Railway. But it keep getting an error, I would like some help to host this by myself.

The error I'm getting is on my page "Server Error Called by Client"

I've configured everything on Railway according to the docs

90 Replies

vmoraes424
FREEOP

8 months ago

564baf2b-7f02-4c82-b6a1-8f7ffb169d88


medim
MODERATOR

8 months ago

Hi! this error you are getting is in the convex dashboard or in your site_armor service?


vmoraes424
FREEOP

8 months ago

is in my site


vmoraes424
FREEOP

8 months ago

when I open it, my screen went white and this error popped in the console


medim
MODERATOR

8 months ago

and how can you be sure it is related to the convex instance?


vmoraes424
FREEOP

8 months ago

I did everything the docs told me to do


vmoraes424
FREEOP

8 months ago

and I had this problem


vmoraes424
FREEOP

8 months ago

I don't know


medim
MODERATOR

8 months ago

Can you access the convex dashboard and try doing some queries?


vmoraes424
FREEOP

8 months ago

yes, in my dashboard hosted on railway is normal


vmoraes424
FREEOP

8 months ago

1382757165349208000


vmoraes424
FREEOP

8 months ago

with nothing in the table


vmoraes424
FREEOP

8 months ago

I have to put this URL in the NEXTPUBLICCONVEX_URL, right?

1382757391837433900


passos
MODERATOR

8 months ago

any error logs on the Convex service?


vmoraes424
FREEOP

8 months ago

lemme see


passos
MODERATOR

8 months ago

iirc when you setup Convex with the CLI it shows an option to use a self hosted deployment


passos
MODERATOR

8 months ago

but seems like it's somehow connecting to Convex from your screenshot, hopefully


vmoraes424
FREEOP

8 months ago

ok, the URL was from the cloud deployment I was trying to do yesterday


passos
MODERATOR

8 months ago

oof


medim
MODERATOR

8 months ago

That was going to be my next question 😅


medim
MODERATOR

8 months ago

There's no referenced env vars in your service


medim
MODERATOR

8 months ago

according to that image


vmoraes424
FREEOP

8 months ago

there we go


vmoraes424
FREEOP

8 months ago

now I receive this error

1382758068697174300


vmoraes424
FREEOP

8 months ago

I tried to ssh this, and run this commands


vmoraes424
FREEOP

8 months ago

but it didnt work as well


passos
MODERATOR

8 months ago

add that command to the pre deploy step of your service and it should work


vmoraes424
FREEOP

8 months ago

which one?


passos
MODERATOR

8 months ago

you can find that by going to your service settings and then look for pre deploy step, should be below the start command


passos
MODERATOR

8 months ago

the nextjs one


passos
MODERATOR

8 months ago

also, I would recommend using reference variables for your service as Medim said.
something like this should work:

NEXT_PUBLIC_CONVEX_URL=https://${{"Convex Backend".RAILWAY_PUBLIC_DOMAIN}}

vmoraes424
FREEOP

8 months ago

I have one

1382758831012053000


vmoraes424
FREEOP

8 months ago

the other one is from yesterday


passos
MODERATOR

8 months ago

but you're hardcoding it instead of using reference variables


vmoraes424
FREEOP

8 months ago

I'll deleve deploy key, right?


passos
MODERATOR

8 months ago

basically Railway will pull up your URL automatically from your service


vmoraes424
FREEOP

8 months ago

hmm


passos
MODERATOR

8 months ago

yep, you'll need a deploy key


vmoraes424
FREEOP

8 months ago

like this?

1382759289415799000


passos
MODERATOR

8 months ago

prefix it with https://


vmoraes424
FREEOP

8 months ago

and where can I find it?


vmoraes424
FREEOP

8 months ago

it automaticly did it


passos
MODERATOR

8 months ago

it's somewhere in the Convex dashboard


vmoraes424
FREEOP

8 months ago

because in the dasboard it shows this

1382759535751467000


vmoraes424
FREEOP

8 months ago

that's why i didn't put it


passos
MODERATOR

8 months ago

I don't remember that variable already including https:// so I would check it before hand


vmoraes424
FREEOP

8 months ago

yeah it did


passos
MODERATOR

8 months ago

oh then I would follow what Convex is saying to do, unfortunately I'm not that familiar with the self hosted option


vmoraes424
FREEOP

8 months ago

ok


vmoraes424
FREEOP

8 months ago

back to the pre deploy command


vmoraes424
FREEOP

8 months ago

i didnt find


vmoraes424
FREEOP

8 months ago

do you know what it is?


passos
MODERATOR

8 months ago

sorry, it's called pre-deploy step

1382760011821744400


vmoraes424
FREEOP

8 months ago

ok, but I put npx convex dev in there?


passos
MODERATOR

8 months ago

no, you put npx convex deploy as you're not in dev anymore


vmoraes424
FREEOP

8 months ago

ok, let's see what it builds


vmoraes424
FREEOP

8 months ago

ok, it crashed

1382761289314734300


vmoraes424
FREEOP

8 months ago

<:lfg:786867302888505364>


passos
MODERATOR

8 months ago

hmm, can you send full logs?


passos
MODERATOR

8 months ago

weird that it didn't find the .next build directory


vmoraes424
FREEOP

8 months ago

hmm


vmoraes424
FREEOP

8 months ago

I put next build && npx convex deploy now


vmoraes424
FREEOP

8 months ago

but i dont think its gonna work


vmoraes424
FREEOP

8 months ago

it it appears to be working

1382761743171846400


medim
MODERATOR

8 months ago

hmmm


medim
MODERATOR

8 months ago

it's using the cloud one


medim
MODERATOR

8 months ago

no?


vmoraes424
FREEOP

8 months ago

im trying to redeploy with the npx convex deploy


vmoraes424
FREEOP

8 months ago

yeah, I think so


vmoraes424
FREEOP

8 months ago

ok, got it


vmoraes424
FREEOP

8 months ago

i had to put this command

1382765424701346000


vmoraes424
FREEOP

8 months ago

and this two other variables

1382765458557768000


vmoraes424
FREEOP

8 months ago

thanks guys for the help


vmoraes424
FREEOP

8 months ago

appreciate it


passos
MODERATOR

8 months ago

great but still weird


passos
MODERATOR

8 months ago

are you sure that you did set on the pre-deploy step and not on the custom build command?


vmoraes424
FREEOP

8 months ago

no


vmoraes424
FREEOP

8 months ago

it went in the build


vmoraes424
FREEOP

8 months ago

and worked


vmoraes424
FREEOP

8 months ago

soooo


passos
MODERATOR

8 months ago

oh that's where it failed


vmoraes424
FREEOP

8 months ago

I'm not touching it


vmoraes424
FREEOP

8 months ago

before it was in pre-deploy


vmoraes424
FREEOP

8 months ago

now is in build


passos
MODERATOR

8 months ago

hmmm maybe Convex somehow needs to know the build command


passos
MODERATOR

8 months ago

anyway, nice to know it's working!


vmoraes424
FREEOP

8 months ago

thank you for the help


vmoraes424
FREEOP

8 months ago

vamo brasil



vmoraes424
FREEOP

8 months ago

see you there


Loading...