9 months ago
I’m having an issue deploying my Discord.js v14 bot on Railway.
The bot uses ES modules (type: module), with commands and events organized in folders, and runs an Express webserver on port 8080. It works perfectly fine locally.
On Railway deployment, the logs show:
⏳ Registering slash commands... ✅ Connected to PostgreSQL ✅ Commands registered successfully.
And then nothing else happens. The ready event never fires, and the bot never goes online.
I’ve verified:
✅ Environment variables are correctly set on Railway.
✅ client.login() is called properly.
✅ Intents (Guilds, GuildMessages, MessageContent, GuildVoiceStates) are enabled in code.
✅ PostgreSQL connection is successful.
✅ Express server listens on process.env.PORT || 8080.
I also added debug, warn, and error listeners on the client, but no errors or additional logs appear.
Also, the second attached image shows the log in my local server. As you can see, completely different sittuation…
Repo is here: https://github.com/Pauloonada/trex-discordbot
Has anyone encountered this before or has ideas what else I should check?
Thanks a lot for any help!
6 Replies
9 months ago
It looks like you are trying to fetch the commands from the file system but since the original code/files isn't available post build they don't technically exist to the program.
9 months ago
I would assume that fetching the files in a directory just returns an empty array hence the 0 errors.
9 months ago
Not sure why the bot isn't logging in though.
9 months ago
It just looks like it is only running the deployCommands.js file, can you show the build logs?
9 months ago
Mainly the railpack build plan.