2 months ago
Can anyone help me relaunch bot , not sure if url is wrong or whats going on. Im getting guild not found errors though and i wasnt on other hosting service. TY
38 Replies
2 months ago
Hey there! We've found the following might help you get unblocked faster:
If you find the answer from one of these, please let us know by solving the thread!
2 months ago
This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.
Status changed to Open brody • about 2 months ago
2 months ago
If i cant get any help i can go back to other hosting service.
2 months ago
Hi,
You'll need to share some information. Logs, errors, anything please.
2 months ago
[dotenv@17.2.2] injecting env (0) from .env -- tip:
run anywhere with dotenvx run -- yourcommand
Express server running on port 8080
/app/node_modules/discord.js/src/client/Client.js:217
if (!token || typeof token !== 'string') throw new DiscordjsError(ErrorCodes.TokenInvalid);
^
Error [TokenInvalid]: An invalid token was provided.
at Client.login (/app/node_modules/discord.js/src/client/Client.js:217:52)
at Object.<anonymous> (/app/index.js:74:8)
at Module._compile (node:internal/modules/cjs/loader:1706:14)
at Object..js (node:internal/modules/cjs/loader:1839:10)
at Module.load (node:internal/modules/cjs/loader:1441:32)
at Function._load (node:internal/modules/cjs/loader:1263:12)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:237:24)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:171:5)
at node:internal/main/run_main_module:36:49 {
code: 'TokenInvalid'
}
Node.js v22.20.0
2 months ago
it was saying Guild not found and now its saying token not found , i feel the url is wrong , i have all my values corrected already. When i ping bot its working on server. Also i want to let who ever is helping me know im not a coder. I built all this stuff with AI with scripts in google sheets and hosted a discord bot. It was all working i had and actual coder help me. Then i swopped discord bot hosting and now i cant get the code to talk to bot to pull my information right. This is why i wanted to go back to where he had it hosted
2 months ago
this is my errors from my scripts !
11:00:48 AM
Notice
Execution started
11:00:49 AM
Info
Discord data feed issue: Exception: Request failed for https://deadlybot-production.up.railway.app returned code 502. Truncated server response: {"status":"error","code":502,"message":"Application failed to respond","request_id":"LXNAOQYBRNuUt7VnezItjw"} (use muteHttpExceptions option to examine full response)
11:00:49 AM
Notice
Execution completed
2 months ago
i just noticed it says port 8080 and i ws not running on that port fixed that , made sure all values had correct names
2 months ago
> wantedbot@1.0.0 start
> node index.js
at Module._compile (node:internal/modules/cjs/loader:1706:14)
at Object..js (node:internal/modules/cjs/loader:1839:10)
at Module.load (node:internal/modules/cjs/loader:1441:32)
at Function._load (node:internal/modules/cjs/loader:1263:12)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:237:24)
Express server running on port 8080
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:171:5)
/app/node_modules/discord.js/src/client/Client.js:217
at node:internal/main/run_main_module:36:49 {
if (!token || typeof token !== 'string') throw new DiscordjsError(ErrorCodes.TokenInvalid);
code: 'TokenInvalid'
}
^
Node.js v22.20.0
Error [TokenInvalid]: An invalid token was provided.
at Client.login (/app/node_modules/discord.js/src/client/Client.js:217:52)
at Object.<anonymous> (/app/index.js:74:8)
2 months ago
11:27:31 AM
Notice
Execution started
11:27:47 AM
Info
Discord data feed issue: Exception: Request failed for https://deadlybot-production.up.railway.app returned code 502. Truncated server response: {"status":"error","code":502,"message":"Application failed to respond","request_id":"pjLILov5RneG05VJezItjw"} (use muteHttpExceptions option to examine full response)
11:27:47 AM
Notice
Execution completed
2 months ago
it keeps changing the request_id":"pjLILov5RneG05VJezItjw". evertime it runs .. this is API generation ? for the hosting server? confused lol
2 months ago
Hey, so based on your logs the key issue seems to be here:
"[dotenv@17.2.2] injecting env (0) from .env"
This is showing that, no environment variables were loaded and therefore no Discord token reaching your app.
You said you have all values corrected. Where did you add them? In Railway's Variables tab or somewhere else? And when you added them, did a new deployment start?
2 months ago
i put a screen shot of where the variables are added in railway in the post above .. I have them in both though i have them in google sheets too as variables , i have lots of code this particular one is not working for me
2 months ago
Here is both screen shots of my variables , one part is in google sheets and one part is in new hosting
service.. Everything worked before i switch hosting service
Attachments
2 months ago
i can give the code here for list and the google sheets if that helps, AI keeps telling me same thing and fix whats correct so im stuck at a wall with AI, its telling me my ID or my names are wrong but they seem to match everywhere
2 months ago
Ai keeps trying to change code or make it work different but it was working fine so i dont want to change that lol
sarangsohail
Hey, so based on your logs the key issue seems to be here:"[dotenv@17.2.2] injecting env (0) from .env"This is showing that, no environment variables were loaded and therefore no Discord token reaching your app.You said you have all values corrected. Where did you add them? In Railway's Variables tab or somewhere else? And when you added them, did a new deployment start?
2 months ago
yes ! it did start but i made sure to run the redeployment manually
2 months ago
its crashing after deployment , before i even run code too
2 months ago
here is what AI is telling me lol...
How to fix it
Go to Railway → your project → Variables.
Make sure you have:
NameValueDISCORD_TOKEN<your valid Discord bot token>DISCORD_SERVER_ID<your server ID>
No quotes, no spaces, raw text.
Click Restart Service.
Check the logs — you should see:
2 months ago
and then i get same issues but its right
djvial
yes ! it did start but i made sure to run the redeployment manually
2 months ago
Based on your screenshots, you're missing DISCORD_BOT_URL in Railway's variables.
Google Sheets has 4 variables, Railway only has 3.
Can you please add DISCORD_BOT_URL to Railway with the same value from your Google Sheets, then redeploy?
2 months ago
ok,, is this my value ? https://deadlybot-production.up.railway.app. i dont know the URL i changed hosting services thats my issue
djvial
ok,, is this my value ? https://deadlybot-production.up.railway.app. i dont know the URL i changed hosting services thats my issue
2 months ago
Yep, try that please.
2 months ago
> wantedbot@1.0.0 start
> node index.js
[dotenv@17.2.2] injecting env (0) from .env -- tip:
run anywhere with dotenvx run -- yourcommand
at Object..js (node:internal/modules/cjs/loader:1839:10)
at Module.load (node:internal/modules/cjs/loader:1441:32)
at Function._load (node:internal/modules/cjs/loader:1263:12)
Error [TokenInvalid]: An invalid token was provided.
Express server running on port 8080
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at Client.login (/app/node_modules/discord.js/src/client/Client.js:217:52)
Node.js v22.20.0
at wrapModuleLoad (node:internal/modules/cjs/loader:237:24)
/app/node_modules/discord.js/src/client/Client.js:217
at Object.<anonymous> (/app/index.js:74:8)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:171:5)
at Module._compile (node:internal/modules/cjs/loader:1706:14)
at node:internal/main/run_main_module:36:49 {
if (!token || typeof token !== 'string') throw new DiscordjsError(ErrorCodes.TokenInvalid);
code: 'TokenInvalid'
^
2 months ago
i should have stayed with google hosting .. this is a nightmare been
down for 3 days now
2 months ago
Sorry about the downtime and trouble.
The error in the logs is still the same, which means the app isn't getting the variables yet.
When you added the variables in Railway, did you see a banner at the top of the dashboard that said something like "Apply changes" or "Deploy changes"?
Also, when you said you "redeployed manually" - where exactly did you click to redeploy? Was it:
1. A "Deploy" button in a banner at the top of the canvas, or
2. Three dots next to an old deployment, then "Redeploy"?
This matters because option 1 deploys the new variables, while option 2 redeploys with the old configuration.
2 months ago
3 dots then hit redeploy for manual. But when i changed it it rebuild it self when i hit commit on the repository on git hub it rebuilt it automatically too. if i change that anyway but if i make any changes anywhere it updates
2 months ago
Could you please tell me if you see a button like the onc attached below on the very top of your page (on the main canvas view)?
I am asking this as when you add variables in Railway, they become "staged changes". This means that it requires an explicit deployment via this button as opposed to the "3 dots → Redeploy" approach because that deploys OLD config (no new variables). This is also the case with GitHub auto-rebuild.
If it is showing, please click deploy and wait for it to complete and keep an eye on the logs for any crashes.
If you don't see this button: Please share a screenshot of your variables tab so I can help troubleshoot further.
Attachments
2 months ago
yes i hit that button ! 11:02:47 AM
Notice
Execution started
11:02:51 AM
Info
Discord data feed issue: Exception: Request failed for https://deadlybot-production.up.railway.app returned code 404. Truncated server response: {"error":"Guild not found"} (use muteHttpExceptions option to examine full response)
11:02:51 AM
Notice
Execution completed
2 months ago
> wantedbot@1.0.0 start
> node index.js
[dotenv@17.2.2] injecting env (0) from .env -- tip:
prevent committing .env to code: https://dotenvx.com/precommit
Express server running on port 8080
Logged in as DeadlyBot#3922
(node:20) DeprecationWarning: The ready event has been renamed to clientReady to distinguish it from the gateway READY event and will only emit under that name in v15. Please use clientReady instead.
(Use node --trace-deprecation ... to show where the warning was created)
Guild not found:
1053339442259173467
Guild not found:
1053339442259173467
2 months ago
Bot didnt crash at least it just came back with g not found
2 months ago
I redeployed added port 8080 even to variables . Still guild not found , reinvited the bot to make sure it was good too and it just cant seem to call home like it did before
2 months ago
Starting Container
> wantedbot@1.0.0 start
> node index.js
npm warn config production Use --omit=dev instead.
[dotenv@17.2.2] injecting env (0) from .env -- tip:
encrypt with Dotenvx: https://dotenvx.com
Express server running on port 8080
Logged in as DeadlyBot#3922
(node:20) DeprecationWarning: The ready event has been renamed to clientReady to distinguish it from the gateway READY event and will only emit under that name in v15. Please use clientReady instead.
(Use node --trace-deprecation ... to show where the warning was created)
Guild not found:
1053339442259173467
Attachments
2 months ago
11:16:55 AM
Notice
Execution started
11:16:58 AM
Info
Discord data feed issue: Exception: Request failed for https://deadlybot-production.up.railway.app returned code 404. Truncated server response: {"error":"Guild not found"} (use muteHttpExceptions option to examine full response)
11:16:58 AM
Notice
Execution completed
djvial
Starting Container> wantedbot@1.0.0 start> node index.jsnpm warn config production Use --omit=dev instead.[dotenv@17.2.2] injecting env (0) from .env -- tip: encrypt with Dotenvx: https://dotenvx.comExpress server running on port 8080Logged in as DeadlyBot#3922(node:20) DeprecationWarning: The ready event has been renamed to clientReady to distinguish it from the gateway READY event and will only emit under that name in v15. Please use clientReady instead.(Use node --trace-deprecation ... to show where the warning was created)Guild not found:1053339442259173467
2 months ago
Logged in as DeadlyBot#3922
It looks like your bot has successfully authenticated.
The guild issue is because your bot is looking for guild ID 1053339442259173467 but can't find it. You said you re-invited the bot, so here's what to check:
Can you verify your DISCORD_SERVER_ID variable in Railway?
Click on
DISCORD_SERVER_IDin your variablesCheck if the value matches
1053339442259173467
If it doesn't match, that's the problem. Update it to the correct server ID:
Right-click your Discord server name → Copy Server ID
Update the variable in Railway
Click Deploy
If it does match 1053339442259173467, then the issue might be hardcoded in your code. Can you share what's around line 74 in your index.js? (That's where the error is coming from based on the logs).
2 months ago
he Discord server IDS do match ..
this is index.js code 69 to end ...
app.listen(PORT, () => {
console.log
Express server running on port ${PORT});
});
// ---- LOGIN ----
client.login(process.env.DISCORD_TOKEN);
djvial
he Discord server IDS do match ..this is index.js code 69 to end ...app.listen(PORT, () => {console.log Express server running on port ${PORT});});// ---- LOGIN ----client.login(process.env.DISCORD_TOKEN);
2 months ago
I got it going , it was just firing to fast and fumbling , i figured it out and changed operation order and it fixed it... TY
Status changed to Solved djvial • about 2 months ago