R
Railway2mo ago
Koe

Prisma + Mongo DB Railway

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
No description
No description
No description
17 Replies
Percy
Percy2mo ago
Project ID: N/A
Medim
Medim2mo ago
You're using the internal url That one is used for communication between service INSIDE the railway private network
Koe
KoeOP2mo ago
I also try to use the public one but I get the same error
No description
Medim
Medim2mo ago
does the URL follows the same pattern stated in the prisma docs? https://www.prisma.io/docs/orm/reference/connection-urls#mongodb
Koe
KoeOP2mo ago
Sorry, I'm not used to this problem, I normally used MySQL or PostgreSQL and this error is new for me
Medim
Medim2mo ago
No problems, just check if your db url follows this pattern: "mongodb+srv://root:<password>@cluster0.ab1cd.mongodb.net/myDatabase?retryWrites=true&w=majority"
Koe
KoeOP2mo ago
Oh I see, I should adapt the url that railway gives me
Medim
Medim2mo ago
Does your URL string starts with mongodb+srv://? Did you put the database at the end? /your-db-here
Koe
KoeOP2mo ago
mongodb://mongo:[email protected]:39175 I am trying to adapt this url according to the prisma documentation but I don't know very well how. :catsad:
Medim
Medim2mo ago
er uhm delete it u just showed me your creds :kekw:
Koe
KoeOP2mo ago
Don't worry, just create a test one
Medim
Medim2mo ago
ok. mongodb://mongo:[email protected]:39175/railway?retryWrites=true&w=majority in the prisma docs they also include this ?retryWrites=true&w=majority at the end, probably some connection config that it needs
Koe
KoeOP2mo ago
Coincidentally, I tried it like this without the last one, but it still doesn't work. :sad_hamster:
Medim
Medim2mo ago
mongodb://mongo:[email protected]:39175/railway?retryWrites=true&w=majority try without the +srv
Koe
KoeOP2mo ago
thank very much, but... can't work :sadblob: ehhh
Medim
Medim2mo ago
:cryingman:
Koe
KoeOP2mo 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
Want results from more Discord servers?
Add your server