MongoDB connection and Routing
alets17
TRIALOP

2 years 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

brody
EMPLOYEE

2 years ago

Are you committing your node_modules folder to GitHub?


alets17
TRIALOP

2 years ago

Yes, my node_modules folder is on Github


brody
EMPLOYEE

2 years ago

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


alets17
TRIALOP

2 years 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


brody
EMPLOYEE

2 years ago

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


alets17
TRIALOP

2 years ago

Where can I find the domain?


brody
EMPLOYEE

2 years ago

In the service settings.


alets17
TRIALOP

2 years 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


brody
EMPLOYEE

2 years 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.


alets17
TRIALOP

2 years ago

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


brody
EMPLOYEE

2 years ago

Yes, lots of people do that.


alets17
TRIALOP

2 years 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


brody
EMPLOYEE

2 years 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.


alets17
TRIALOP

2 years ago

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


brody
EMPLOYEE

2 years ago

Happy to help!


Loading...