Prisma + Mongo DB Railway
miguedev1047
HOBBYOP

2 years ago

I am trying to connect to the database using the URL provided by Railway. I have a .env file where I have the environment variable where I establish that URL (which railway gives me) but it doesn't connect me and I don't really understand why

Closed

25 Replies

2 years ago

You're using the internal url


2 years ago

That one is used for communication between service INSIDE the railway private network


miguedev1047
HOBBYOP

2 years ago

I also try to use the public one but I get the same error

1293283702779940885


2 years ago

does the URL follows the same pattern stated in the prisma docs?

https://www.prisma.io/docs/orm/reference/connection-urls#mongodb


miguedev1047
HOBBYOP

2 years ago

Sorry, I'm not used to this problem, I normally used MySQL or PostgreSQL and this error is new for me


2 years ago

No problems, just check if your db url follows this pattern:

"mongodb+srv://root:@cluster0.ab1cd.mongodb.net/myDatabase?retryWrites=true&w=majority"


miguedev1047
HOBBYOP

2 years ago

Oh I see, I should adapt the url that railway gives me


2 years ago

Does your URL string starts with

mongodb+srv://?

Did you put the database at the end?

/your-db-here


miguedev1047
HOBBYOP

2 years ago

||mongodb://mongo:pjUxJYpgWlNcrSAqefuZgyjYAUWRtMZT@autorack.proxy.rlwy.net:39175||

I am trying to adapt this url according to the prisma documentation but I don't know very well how.


miguedev1047
HOBBYOP

2 years ago

<:catsad:1111008884820279408>


2 years ago

er uhm


2 years ago

delete it


2 years ago

u just showed me your creds


2 years ago

<:kekw:788259314607325204>


miguedev1047
HOBBYOP

2 years ago

Don't worry, just create a test one


2 years ago

ok.


2 years ago

mongodb://mongo:pjUxJYpgWlNcrSAqefuZgyjYAUWRtMZT@autorack.proxy.rlwy.net:39175/railway?retryWrites=true&w=majority


2 years ago

in the prisma docs they also include this ?retryWrites=true&w=majority at the end, probably some connection config that it needs


miguedev1047
HOBBYOP

2 years ago

Coincidentally, I tried it like this without the last one, but it still doesn't work. <:sad_hamster:1280780987504267328>


2 years ago

mongodb://mongo:pjUxJYpgWlNcrSAqefuZgyjYAUWRtMZT@autorack.proxy.rlwy.net:39175/railway?retryWrites=true&w=majority


2 years ago

try without the +srv


miguedev1047
HOBBYOP

2 years ago

thank very much, but... can't work


miguedev1047
HOBBYOP

2 years ago

ehhh


2 years ago

<:cryingman:786867299553378324>


miguedev1047
HOBBYOP

2 years ago

i will see if they allow me to change databases, this problem is only happening to me in mongo db, in the other databases I have not had this problem


Welcome!

Sign in to your Railway account to join the conversation.

Loading...