R
Railway2y ago
x4zx

Why did this error occur? The app itself works, but it's annoying me

As usual, I deployed my bot and here it is
28 Replies
Percy
Percy2y ago
Project ID: N/A
Percy
Percy2y ago
⚠️ experimental feature
x4zx
x4zxOP2y ago
N/A
Adam
Adam2y ago
Set an environment variable called PORT to 8080 and ensure that the same value is being set in your app Your app should either be hardcoding that value or pulling it from the environment variables
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Adam
Adam2y ago
Just noticed you asked why, might as well give an explanation. Railway expects a port to be exposed, but your app is exposing a different port. To fix this, you have to ensure that your app is exposing the port that Railway expects. You can set the port that Railway expects by setting the PORT environment variable to a 4 digit number (usually 3000, 8000, 8080). Once you've done that, set the port that your app is exposed on. This is usually done through a PORT variable in your code. You can set it to copy from the environment variable (recommended) or hardcode it.
x4zx
x4zxOP2y ago
It's just that I don't use anything that requires a port.
Adam
Adam2y ago
Yes you do, all webapps require a port Even discord bots
x4zx
x4zxOP2y ago
Well, I say this to the fact that I have nowhere to use port 8080 in my code
Adam
Adam2y ago
Please send your code, I'll take a look Also, you're trying to access the URL of your bot. Is your bot prepared to take those requests? Most discord bots aren't
x4zx
x4zxOP2y ago
I think maybe because of this
Adam
Adam2y ago
That's your database connection, that won't cause the issue
x4zx
x4zxOP2y ago
I don't have anything like that anymore.
Adam
Adam2y ago
Then why did you send that part of your code? Please send your repo. You would have defined port somewhere in your code
x4zx
x4zxOP2y ago
I thought she was the problem
x4zx
x4zxOP2y ago
GitHub
GitHub - x4zx/GiveawayBot
Contribute to x4zx/GiveawayBot development by creating an account on GitHub.
Adam
Adam2y ago
First off, delete the procfile, you don’t need that on Railway
x4zx
x4zxOP2y ago
How do you run the main file then?
Adam
Adam2y ago
build and start commands, Railway auto detects what it thinks should be run or you can override it in the settings or a dockerfile, or a nixpacks.toml
x4zx
x4zxOP2y ago
Understood
Adam
Adam2y ago
I’m completely unfamiliar with pymongo and disnake, but I’m not seeing any code built to handle requests. What do you expect to see what you access your bot’s url?
x4zx
x4zxOP2y ago
What is a bot URL? It's just the first time I've heard of this
Adam
Adam2y ago
I mean the URL on Railway. What you’re accessing when you see the Application error you originally posted about
x4zx
x4zxOP2y ago
I did nothing, the site itself gave this error after the deployment
Adam
Adam2y ago
what I’m saying is that I don’t think your app is creating a site what do you expect when you go to the site?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Adam
Adam2y ago
that’s what I’m trying to get at, was just making sure that they’re not expecting that domain to actually display any content
x4zx
x4zxOP2y ago
Exactly, this domain was. I removed it
Want results from more Discord servers?
Add your server