I get this error and I dont understand it

(node:175) UnhandledPromiseRejectionWarning: DiscordjsError: /app/web/pages/index.ejs:54
    52|     <div class="row">
    53|       <% for(var i = 0; i < list.length; i++) { %>
 >> 54|       <% let x = await _client.users.fetch(list[i].id); let bot = list[i];%>
    55|       <%- await include('../blocks/cards.ejs', {bot, x, _client}) -%>
    56|       <% } %>
    57|     </div>
Request to use token, but token was unavailable to the client.
    at RequestHandler.execute (/rbd/pnpm-volume/4e137655-d8bd-4cdc-8cab-053249aaf6a4/node_modules/.registry.npmjs.org/discord.js/12.2.0/node_modules/discord.js/src/rest/RequestHandler.js:107:21)
    at RequestHandler.push (/rbd/pnpm-volume/4e137655-d8bd-4cdc-8cab-053249aaf6a4/node_modules/.registry.npmjs.org/discord.js/12.2.0/node_modules/discord.js/src/rest/RequestHandler.js:41:19)
    at /rbd/pnpm-volume/4e137655-d8bd-4cdc-8cab-053249aaf6a4/node_modules/.registry.npmjs.org/discord.js/12.2.0/node_modules/discord.js/src/rest/RESTManager.js:41:10
    at new Promise (<anonymous>)
    at RESTManager.push (/rbd/pnpm-volume/4e137655-d8bd-4cdc-8cab-053249aaf6a4/node_modules/.registry.npmjs.org/discord.js/12.2.0/node_modules/discord.js/src/rest/RESTManager.js:39:12)
    at RESTManager.request (/rbd/pnpm-volume/4e137655-d8bd-4cdc-8cab-053249aaf6a4/node_modules/.registry.npmjs.org/discord.js/12.2.0/node_modules/discord.js/src/rest/RESTManager.js:60:17)
    at Proxy.<anonymous> (/rbd/pnpm-volume/4e137655-d8bd-4cdc-8cab-053249aaf6a4/node_modules/.registry.npmjs.org/discord.js/12.2.0/node_modules/discord.js/src/rest/APIRouter.js:30:19)
    at UserManager.fetch (/rbd/pnpm-volume/4e137655-d8bd-4cdc-8cab-053249aaf6a4/node_modules/.registry.npmjs.org/discord.js/12.2.0/node_modules/discord.js/src/managers/UserManager.js:63:50)

and this

at processTicksAndRejections (internal/process/task_queues.js:88:5)
(node:175) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 297)

I think it is a good idea to start coding questions with a short overview of what I’m attempting to do.

Someone familiar with EJS may be able to offer more help but I’ll ask the first few questions. Is “anything” working? In other words do you have several examples of pulling information from Discord this way and just this particular example doesn’t work?

I will take a quess and suggest that the code isn’t logging into Discord and/or it has not supplied a valid Discord token or perhaps no token at all.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.