Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using the ShardManager, if the token is invalid, it will return an error that doesnt describe at all what is happening. #4778

Closed
1 task
Soldr opened this issue Sep 2, 2020 · 1 comment · Fixed by #4779

Comments

@Soldr
Copy link

Soldr commented Sep 2, 2020

using ShardManager, very basic

Further details:

Returns an error:
(node:10640) UnhandledPromiseRejectionWarning: #
Running base index.js (my sharder is in sharder.js) returns invalid token error.

  • discord.js version: 12.3.1

  • Node.js version: 12.18.2

  • Operating system: Windows

  • Priority this issue should have – please be realistic and elaborate if possible: No priority

  • I have also tested the issue on latest master, commit hash:

@almostSouji
Copy link
Member

almostSouji commented Sep 2, 2020

Going forward: Please provide your code and reproducible (minimal) code sample as well as detailed instruction steps that are reproducible for yourself, so we can try and reproduce it under the same conditions.

Which location has the wrong token? I tried altering either as well as both locations where a token is usually provided and received the expected Error [TOKEN_INVALID]: An invalid token was provided. or (if i completely mess my code up Error [TOKEN_MISSING]: Request to use token, but token was unavailable to the client.)

After much more digging (thanks space) we found the issue

discord.js/src/util/Util.js

Lines 246 to 247 in b0ab37d

if (res.ok) return res.json();
throw res;

With an invalid token this throws the response when we try to fetch the recommended amount of shards to spawn (hence why i could not reproduce this earlier, as i provide the shard count manually for testing purposes)

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants