Need assistance with hosting JS-web project

Hello, im trying to host an Assistants discord bot Dashboard. I need help with deploying and domain installing
Solution:
don't put tokens of any kind on code, use service variables https://docs.railway.app/develop/variables add the missing fields to the package.json, you could find the missing fields online or from doing npm init in another folder, and looking at the newly created package.json...
Jump to solution
81 Replies
Percy
Percy13mo ago
Project ID: e5992fe2-93c8-4531-949c-97634b766726
Brody
Brody13mo ago
please share your repo
Консерватор
One second
Консерватор
GitHub
GitHub - Ruddien/DashBoard
Contribute to Ruddien/DashBoard development by creating an account on GitHub.
Brody
Brody13mo ago
that's not a valid package.json
Консерватор
Im using example package.json. xxx - just for not sharing my tokens to public If it`s wrong, what should i do?
Solution
Brody
Brody13mo ago
don't put tokens of any kind on code, use service variables https://docs.railway.app/develop/variables add the missing fields to the package.json, you could find the missing fields online or from doing npm init in another folder, and looking at the newly created package.json
Консерватор
I searched for a variables, and how i should paste they in the code?
No description
Консерватор
In what form?
Консерватор
For example, that one
No description
Консерватор
Sry for dumb q
Brody
Brody13mo ago
please read the docs page I linked, if you for instance had a discord token, you would set a service variable DISCORD_TOKEN to your discord token, then in JavaScript you access that service variables by using process.env.DISCORD_TOKEN the variable you show me here is already automatically set for you, to access it just use process.env.RAILWAY_PUBLIC_DOMAIN in your code
Консерватор
That way?
No description
Brody
Brody13mo ago
don't string quote it
Консерватор
It causes
No description
Консерватор
It`s a json file, config
Brody
Brody13mo ago
ah that's a json file, you can only use process.env in JavaScript
Консерватор
Oh, i dont need a config file I can directly put it on index
Brody
Brody13mo ago
but the bigger issue being your package.json is still not valid
Консерватор
I start from begin Now it should be valid
Brody
Brody13mo ago
have you just pushed a new change to your repo?
Brody
Brody13mo ago
you would need a start script, but other than the missing start script, it looks fine
Консерватор
Like that?
Brody
Brody13mo ago
perfect please also read this https://docs.railway.app/troubleshoot/fixing-common-errors since you are running a web server
Консерватор
Im sorry, i have some ex. but im too busy last days.
Like that?:
No description
Brody
Brody13mo ago
looks good
Консерватор
For that variable i should use proccess.env.Domain?
No description
Консерватор
Just an example variable
Brody
Brody13mo ago
not too sure why you need to set a domain variable, just use process.env.RAILWAY_PUBLIC_DOMAIN directly in code
Консерватор
Yea, i know it It`s just an example
Brody
Brody13mo ago
what domain do you want to set? they're just in KEY=value format and per the standard, the key is always fully capitalised, with underscores to separate words
Консерватор
proccess.env.TOKEN?
No description
Brody
Brody13mo ago
the key (variable name) should be all capital case you have it lowercase
Консерватор
I should name they with capitals only?
Brody
Brody13mo ago
yes always use full capital case when naming service / environment variables nothing bad happens if you don't, but it's just standard to do so
Brody
Brody13mo ago
perfect
Консерватор
So keep it like this in the code it should be : proccess.env.TOKEN?
Brody
Brody13mo ago
correct
Консерватор
Ok, i will fill everything now and will try again.
Консерватор
port variable in the code: proccess.env.PORT?
No description
Консерватор
Or i should create a variable named "PORT"?
Brody
Brody13mo ago
the field names in the object you give to DBD.Dashboard shouldn't be capital case, the capital case only applies to service / environment variable names. but the value you give to the port option should be process.env.PORT || 3000 a PORT variables is automatically generated for you by railway, you don't need to set your own using that double pipe means that when you deploy to railway your app runs with the PORT railway wants your app to run with, and when running locally a PORT environment variable won't exist so your app will run on port 3000
Brody
Brody13mo ago
looks good
Консерватор
What i should do with it?
No description
Консерватор
I transfered everything from config to index (using process.env)
Brody
Brody13mo ago
I don't know what any of that is you haven't done anything with it in your original code, so you don't need to do anything about it now I would presume
Консерватор
My index part
No description
Консерватор
I asked in off. discord server
Brody
Brody13mo ago
the environment variable side of things is looking good to me, but keep in mind I have never used or even heard of discord-dashboard before you opened this thread
Консерватор
BTW, i need to install npm packages or process.env will automatically work when i deploy it to the railway?
Brody
Brody13mo ago
it will automatically work, it's a core api of node locally you don't have any of these service / environment variables set, they are only set on Railway, so once you get this running on railway we can talk about how you can use the railway service variables locally too
Консерватор
stty: when specifying an output style, modes may not be set

/app/node_modules/readline-sync/lib/read.sh: 49: cannot create /dev/tty: No such device or address

stty: invalid argument '-f'

Try 'stty --help' for more information.

/app/node_modules/readline-sync/lib/readline-sync.js:259

if (res.error) { throw res.error; }

^

Error: The current environment doesn't support interactive reading from TTY.

stty: when specifying an output style, modes may not be set

/app/node_modules/readline-sync/lib/read.sh: 49: cannot create /dev/tty: No such device or address

stty: invalid argument '-f'

Try 'stty --help' for more information.

at readlineExt (/app/node_modules/readline-sync/lib/readline-sync.js:221:19)

at tryExt (/app/node_modules/readline-sync/lib/readline-sync.js:258:15)

at /app/node_modules/readline-sync/lib/readline-sync.js:363:15

at _readlineSync (/app/node_modules/readline-sync/lib/readline-sync.js:433:5)

at getValidLine (/app/node_modules/readline-sync/lib/readline-sync.js:775:11)

at exports.question (/app/node_modules/readline-sync/lib/readline-sync.js:857:10)

at ask (/app/node_modules/discord-dashboard/InitFunctions/initPpCheck.js:85:41)

at Timeout._onTimeout (/app/node_modules/discord-dashboard/InitFunctions/initPpCheck.js:103:9)

at listOnTimeout (node:internal/timers:569:17)

at process.processTimers (node:internal/timers:512:7) {

method: 'execFileSync',

program: '/bin/sh',

args: [

'/app/node_modules/readline-sync/lib/read.sh',

'--display',

'#91;Discord#45;dashboard#32;v2#46;3#46;62#93;#58;#32;Do#32;you#32;accept#32;it#63;#32;#40;y#47;n#41;#32;',

'--mask',

'#42;'

],

extMessage: 'stty: when specifying an output style, modes may not be set\n' +

'/app/node_modules/readline-sync/lib/read.sh: 49: cannot create /dev/tty: No such device or address\n' +

"stty: invalid argument '-f'\n" +

"Try 'stty --help' for more information.",

exitCode: 1,

code: undefined,

signal: null

}

Node.js v18.17.1
stty: when specifying an output style, modes may not be set

/app/node_modules/readline-sync/lib/read.sh: 49: cannot create /dev/tty: No such device or address

stty: invalid argument '-f'

Try 'stty --help' for more information.

/app/node_modules/readline-sync/lib/readline-sync.js:259

if (res.error) { throw res.error; }

^

Error: The current environment doesn't support interactive reading from TTY.

stty: when specifying an output style, modes may not be set

/app/node_modules/readline-sync/lib/read.sh: 49: cannot create /dev/tty: No such device or address

stty: invalid argument '-f'

Try 'stty --help' for more information.

at readlineExt (/app/node_modules/readline-sync/lib/readline-sync.js:221:19)

at tryExt (/app/node_modules/readline-sync/lib/readline-sync.js:258:15)

at /app/node_modules/readline-sync/lib/readline-sync.js:363:15

at _readlineSync (/app/node_modules/readline-sync/lib/readline-sync.js:433:5)

at getValidLine (/app/node_modules/readline-sync/lib/readline-sync.js:775:11)

at exports.question (/app/node_modules/readline-sync/lib/readline-sync.js:857:10)

at ask (/app/node_modules/discord-dashboard/InitFunctions/initPpCheck.js:85:41)

at Timeout._onTimeout (/app/node_modules/discord-dashboard/InitFunctions/initPpCheck.js:103:9)

at listOnTimeout (node:internal/timers:569:17)

at process.processTimers (node:internal/timers:512:7) {

method: 'execFileSync',

program: '/bin/sh',

args: [

'/app/node_modules/readline-sync/lib/read.sh',

'--display',

'#91;Discord#45;dashboard#32;v2#46;3#46;62#93;#58;#32;Do#32;you#32;accept#32;it#63;#32;#40;y#47;n#41;#32;',

'--mask',

'#42;'

],

extMessage: 'stty: when specifying an output style, modes may not be set\n' +

'/app/node_modules/readline-sync/lib/read.sh: 49: cannot create /dev/tty: No such device or address\n' +

"stty: invalid argument '-f'\n" +

"Try 'stty --help' for more information.",

exitCode: 1,

code: undefined,

signal: null

}

Node.js v18.17.1
@Brody
Brody
Brody13mo ago
does your app require command line input from the user?
Консерватор
No, as i know wait a sec.. only when u instaling package
Brody
Brody13mo ago
looks like its trying to ask for some kind of input, apps on railway have to run essentially headless and autonomously
Консерватор
So it`s no way , if it need a console input?
Brody
Brody13mo ago
the opposite, its trying to get console input
Консерватор
input*
Brody
Brody13mo ago
you would need to consult the discord-dashboard docs for this one
Консерватор
It should be the solution
Brody
Brody13mo ago
that seems like exactly what you want to do!
Консерватор
it works! finally Can i share a link to u for a testing aim?
Brody
Brody13mo ago
checking aim?
Консерватор
Sorry, not a native speaker
Brody
Brody13mo ago
no worries
Консерватор
Can i post my website link to let u test it Wanna be sure
Brody
Brody13mo ago
sure
Brody
Brody13mo ago
looks fine to me
Консерватор
Thank you too much for assisting ! U my little hero 🙂
Brody
Brody13mo ago
ah how sweet
Консерватор
It was a big pleasure to work with u.
Brody
Brody13mo ago
thank you, and you learn fast!
Консерватор
Thank u so much for ur patience Have a good day and never get upset salute
Brody
Brody13mo ago
haha thank you, have agood day yourself too
Want results from more Discord servers?
Add your server