Error Dashboard
Hello,
I have an error in my dashboard.
Could you help me because I don't understand what's going on
Thanks
51 Replies
It looks like
bot
is undefined. Can you show where you are using this view in the javascript?I looked in the code & bot is not declared
I meant where you were using
ejs.renderFile
Well, that's your problem
Did you copy and paste the code from somewhere else? If so, always try to understand what it's doing first so errors like these don't ariseThat's what I'm trying to understand but personally I find my code correct & I don't understand why I have this error
Because you're not passing in a bot variable
Can you show where you are using this view in the javascript?
Yes, Here is the code : https://pastecord.com/utywamelaq
I meant where you were using ejs.renderFileIn
src\views\index.ejs
you are rendering the head.ejs, and injecting the bot
, user
, and path
variable for use in that file. However, bot
is undefined
That's the only info I can really give you with this contextHow can I define it if it is already defined?
I need to see your code lol
src\views\index.ejs and the javascript where that's rendered
Head.ejs : https://pastecord.com/utywamelaq
You already sent me that, that's not the code I need
Index.ejs : https://pastecord.com/cetufugolu.phptemp
and the javascript where that's rendered
On the code Javascript & notified with this
Here
This is how ejs is rendered
Data is where you would pass in variables, such as
bot
. Obviously you're either not, or passing in the wrong data type.
But I need to see the javascript where the ejs is being rendered
Which is where one of those functions would be called
If you're using expressjs you'd be calling res.render
I think.
But I need to see that code @!" 𝑱𝒂𝒎𝒆𝒔__Do you want to see this code ?
No
I want to see the code where you're rendering
index.ejs
Index.ejs : https://pastecord.com/cetufugolu.phptemp
Again, not
index.ejs
itself. Where you're rendering index.ejs
It might be in the same file as this codeWhich code do you want, because I don't really understand
He wants to see the rendering file
Where the index.ejs file is rendering
Sorry, I missed this haha
@!" 𝑱𝒂𝒎𝒆𝒔__ just send me your index.js
Hello @Lioness100 sorry I was busy.
Here is the index.js
Please send it in text or send a link to a pastebin, I'm on mobile
In what file do you define API routes? Please send that.
Where stuff like this is
In the server.js here it is: https://pastecord.com/ilapatamez.js
What route are you accessing that creates the error
As soon as I log in
This concerns whatever route handles
/
, which is what you get redirected to after login. When you render the page, which you seem to be doing through res.render
or renderTemplate
, you aren't passing in bot
as part of the data object, or the value for bot
is undefinedHow can I fix this error?
Pass bot as part of the data object and make sure it's the client
Could you please show me how to do this?
Show the place in your code where you call
res.render('index.ejs')
or renderTemplate('index.ejs')
or something similarI'm referring to the code where you specifically render index.ejs
Okay, what should I do?
Send it to me
I have sent the code render
^
What should I send you the index.js or the server.js?
I can't really think of another way to word what I've already said, sorry
I have sent you the route & renderTemplate as you requested
I'm looking for the code where you render index.ejs
Where this happens ^
this :
No, I'm referring to where index.ejs specifically is rendered
this :
Yes! That's it
global.Client doesn't exist
It might be global.client lowercase, or you might need to get client a different way
It looks like global.clientSL exists, but I don't know if that's the one you want to yse
It doesn't look like the other client is attached to the global object, you accessed it in server.js via function patameter