Can someone help me deploy my discord bot from Railway?
I have a simple bot I wrote in js that im having trouble deploying via railway. any help would be appreciated
i am aware that im a newb and this is probably a rather uncomplicated issue
Project ID:
||a5ab474b-986a-421e-8057-a321ca3f38cb||
30 Replies
Project ID:
a5ab474b-986a-421e-8057-a321ca3f38cb
Error I got: ==============
ο»ΏUsing Nixpacks
ο»Ώ==============
ο»Ώ
ο»Ώcontext: 3acce8e35f744a1625653fb4066072a8
ο»ΏNixpacks build failed
ο»Ώ
ο»Ώ
ο»ΏNixpacks was unable to generate a build plan for this app.
ο»ΏPlease check the documentation for supported languages: https://nixpacks.com
ο»Ώ
ο»ΏThe contents of the app directory are:
ο»Ώ
ο»Ώ.env
ο»Ώindex.js
ο»Ώpackage-lock.json
Getting Started | Nixpacks
App source + Nix packages + Docker = Image
i see a few things wrong, lets start with the most important one:
you are using a .env file in a github repo, this is a huge security concern, you should not be hardcoding any credentials, please use service variables in railway.
i regened the token but left it there for viewing purposes
so, remove .env and leave it as a variable?
thats good, but please still use service variables
https://docs.railway.app/develop/variables#defining-variables
done, so what now?
after removing the file and fixing the variable i still get that same error
show me your railway service variables please (keep the values hidden)
like this?
is your .env file in your .gitignore file?
no, guessing i should do that
yes please
one moment
let me know when done, so we can move onto the next issue
sorry, was messing around a bit. ive done that, what next
send me your package.json please
SrcShare
Easily share your source code with other developers.
send me your package.json please
ahhh
SrcShare
Easily share your source code with other developers.
you are missing a start script, add one and then resend the file
also you can just send the file through discord, no need to use that share thing
in the mean time, send me your .gitignore file
how do i add a start script?
also
open package.json with a text editor and add one
"start": "node index.js"
??looks about right
does your project now include a package-lock.json file?
yeah that was the first one i sent
good, push your changes to your repo
took a while because my repo... broke
but its done, it says success. im going to verify if the bot stays online
much thanks
no problem!