MongoDB connection and Routing

alets17TRIAL

a year ago

Im trying to deploy a server that connects to my MongoDB cluster, I do not know what is the issue as I've tried using Render, Vercel and now Railway to deplot the server. The code works on my computer running it as a local host but in all 3 websites I get the same error: Error: /opt/render/project/src/nodemodules/bcrypt/lib/binding/napi-v3/bcryptlib.node: invalid ELF header

View Deploy details

ⓘ Deployment information is only viewable by Project members and Railway admins.

15 Replies

a year ago

Are you committing your node_modules folder to GitHub?


alets17TRIAL

a year ago

Yes, my node_modules folder is on Github


a year ago

The node_modules folder should never be in your repo, remove it and then make sure to add it to your .gitignore


alets17TRIAL

a year ago

Ok it seems to be running now. Im trying to deploy this server for a website deployed on Vercel, it was made with Vite. The code of this server fetches information from our MongoDB database but when I have running this service and I open the website with the Vercel URL the data is still not shown


a year ago

What do you see if you visit the domain for your Railway service in your browser?


alets17TRIAL

a year ago

Where can I find the domain?


a year ago

In the service settings.


alets17TRIAL

a year ago

I get a white page with Cannot GET /

I also tried deploying the FrontEnd part of my website and th deploy logs it says that is running on localhost:/5173 but if I enter the Domain of that service i get application failed to respond


a year ago

I get a white page with Cannot GET /

That's completely normal for an API.

I also tried deploying the FrontEnd part of my website and th deploy logs it says that is running on localhost:/5173 but if I enter the Domain of that service i get application failed to respond

That's because you are trying to deploy a development server onto Railway, you would need additional configurations in order to properly deploy front ends to Railway.

You need to have your frontend call the backend domain that Railway has provided for your API.


alets17TRIAL

a year ago

And can I use Vercel for the FrontEnd and Railway for the backend?


a year ago

Yes, lots of people do that.


alets17TRIAL

a year ago

Do you mind giving a look to my repositories to see what can I do to connect the frontEnd with the backend? I'm pretty new to deploying stuff so idk which should be the changes that I need to do


a year ago

That particular question wouldn't really have anything to do with deployments, Your frontend code simply needs to make the fetch requests to the domain Railway has provided you for your API.


alets17TRIAL

a year ago

I think I sort it out. Thank you so much!


a year ago

Happy to help!