Having issues renbdering a ejs page for my dashboard

here is the error, im using discord.js 11.5.1 tyia! :slight_smile:

You use this to get the user avatar:


thats what im doing. ill send the code in question

Just a shot in the dark, but judging from the way the error rendered, could that error be thrown by the spaces in the function call? (after get and before displayAvatarURL ?) I feel like these templating interfaces can be surprisingly picky

oh my goodness. they are like that on the whole page well not the whole page but there is like 5 more like that. i feel so stupid lol

Don’t feel stupid – I think in a lot of contexts it wouldn’t even error!

1 Like

now after fixing that. it is displaying this… is it possible some of the packages are breaking the project?

If the above error is not helpful, you may want to try EJS-Lint:
Or, if you meant to create an async function, pass async: true as an option.
    at new Function (<anonymous>)
    at Template.compile (/rbd/pnpm-volume/ec259052-0b87-4f2d-9f16-15b0e88c9508/node_modules/.registry.npmjs.org/ejs/2.7.1/node_modules/ejs/lib/ejs.js:633:12)
    at Object.compile (/rbd/pnpm-volume/ec259052-0b87-4f2d-9f16-15b0e88c9508/node_modules/.registry.npmjs.org/ejs/2.7.1/node_modules/ejs/lib/ejs.js:392:16)
    at handleCache (/rbd/pnpm-volume/ec259052-0b87-4f2d-9f16-15b0e88c9508/node_modules/.registry.npmjs.org/ejs/2.7.1/node_modules/ejs/lib/ejs.js:215:18)
    at tryHandleCache (/rbd/pnpm-volume/ec259052-0b87-4f2d-9f16-15b0e88c9508/node_modules/.registry.npmjs.org/ejs/2.7.1/node_modules/ejs/lib/ejs.js:254:16)
    at View.exports.renderFile [as engine] (/rbd/pnpm-volume/ec259052-0b87-4f2d-9f16-15b0e88c9508/node_modules/.registry.npmjs.org/ejs/2.7.1/node_modules/ejs/lib/ejs.js:485:10)
    at View.render (/rbd/pnpm-volume/ec259052-0b87-4f2d-9f16-15b0e88c9508/node_modules/.registry.npmjs.org/express/4.17.1/node_modules/express/lib/view.js:135:8)
    at tryRender (/rbd/pnpm-volume/ec259052-0b87-4f2d-9f16-15b0e88c9508/node_modules/.registry.npmjs.org/express/4.17.1/node_modules/express/lib/application.js:640:10)
    at Function.render (/rbd/pnpm-volume/ec259052-0b87-4f2d-9f16-15b0e88c9508/node_modules/.registry.npmjs.org/express/4.17.1/node_modules/express/lib/application.js:592:3)
    at ServerResponse.render (/rbd/pnpm-volume/ec259052-0b87-4f2d-9f16-15b0e88c9508/node_modules/.registry.npmjs.org/express/4.17.1/node_modules/express/lib/response.js:1012:7)
    at renderTemplate (/app/dashboard/index.js:99:9)
    at app.get (/app/dashboard/index.js:471:5)
    at process._tickCallback (internal/process/next_tick.js:68:7)

Oh interesting…I think it would make sense that the bot.get call would be asynchronous. It sounds like ejs might require a flag so that it waits for the function call to resolve before attempting to render the results.

Looking at the docs here, it looks like you can pass an options object into whatever method you use for rendering the HTML string (compile, render or renderFile) and that options object can contain a flag for async: true. Let me know if this doesn’t solve the problem!

1 Like

ty! ill give it a go

sorry for the delayed response. But this was what fixed it! now

1 Like

I’m glad to hear it!