When attempting to connect to MySQL 8.0.21 server running Ubuntu 20.04 using NodeJS and mysql2 package, I receive the common error below: Server requests authentication using unknown plugin sha256_password I know that mysqljs and mysql2 do not support sha256, so I confirmed my user was setup for mysql_native_password: And have confirmed that default_authentication_plugin is set as mysql_native_password. What makes this
Tag: node.js
Traversing recursively through an array and modifying values of object properties in JavaScript
The post may seem lengthy but it’s quite easy to follow, if not, I will add more details I have criteria array which that looks like : Characteristics of criteria: It could have nested arrays. First item array (or nested array) is always going to be either “and” or “or” Second item onwards in array, item could be either an
What does Message.fetch() actually do in discord.js
According to the Message#fetch() docs, this function simply fetches the message it was called on. However, I’m not sure in which circumstance it would ever make sense to use this function. According to the screenshot above, this method returns Promise<Message>. I’m confused, because why would you need to fetch a message you already have access to? For example: So, what’s
Why is awaiting a reaction isnt working Discord.js V12
I tried to make a confirmation system by awaiting a reaction from this user, for some reason, I can’t get it to work. Here is the code: If anyone could help, it would be great! Thanks. Answer I was reviewing your code and I think I fixed it since I have tried this and it worked as expected. The explanation
Unable to customize AWS SES email template
I am trying to send a forgot password mail through AWS SES service. I made this template And this is my code in nodejs to input password reset link. In this Url is what i am trying to send. However when I receive the mail its it does not show the link but only the html text ” But don’t
How to add permissions to user to channel by command? Discord.js
How to give permissions to a specific channel by command? Sorry, I’m new at discord.js so any help would be appreciated. Answer You can use GuildChannel.updateOverwrites() to update the permissions on a channel. (From example in the discord.js docs) Using this function, you can provide a User or Role Object or ID of which to update permissions (in your case,
Node: Using promise.all() to call API’s in parallel?
I’m a bit confused how promise.all work, does it run the array of promises in parallel? So here is a sample code From what I observed, Promise.all runs the promises in parallel, and wait for all promises to finish. Answer does it run the array of promises in parallel Promise.all doesn’t, no; your code does (well, probably; see the Notes
Is Express.js platform-independent?
I’m just starting out with Express.js. In the official getting started guide, they showed the following basic code: The first parameter to app.get() is a forward-slash indicating the root directory. But the slash is a backward-slash in windows systems. Does express deal with these differences automatically, or do we need to write extra code for it? When I was using
Mongoose populate subdocument in array
I have a Mongoose offer model explained below: and order schema which has reference to to the first schema offer explained below: the problem that I can not populate sections here {section: { type: Schema.Types.ObjectId, ref: ‘Offer.sections’ }} it gives me MissingSchemaError: Schema hasn’t been registered for model “Offer.sections”. so is there any way to populate sections? Answer Unfortunately, Mongoose
How to make AJAX request in Hackerrank using JavaScript?
I open the Hackerrank example test and play around with methods one might use to make an AJAX call. XMLHttpReq, fetch, etc. None of them work; XHR and fetch methods are unavailable. First fetch: Hackerrank throws an error because fetch is not a function. I also tried window.fetch and global.fetch to no avail. I tried XHR: Hackerrank says XMLHttpRequest is