Questions tagged [node.js]

Node.js is an event-based, non-blocking, asynchronous I/O runtime that uses Google's V8 JavaScript engine and libuv library. It is used for developing applications that make heavy use of the ability to run JavaScript both on the client, as well as on server side and therefore benefit from the re-usability of code and the lack of context switching.

Filter by
Sorted by
Tagged with
0 votes
0 answers
4 views

How to instantiate and return a wrapped C++ object from AsyncWorker

I'm following the Node Addon API documentation to resolve a promise on the C++ side. On resolve I'd like to return a C++ object back to JS. My code is similar to what is here. The main difference is ...
user avatar
  • 922
0 votes
0 answers
4 views

How to search tree structure with multiple types with TypeORM

thanks for reading and provide any suggestions or any keyword I can do more research. Quite new to TypeORM and have an issue on searching the tree structure with TypeORM. The tree structure is a ...
user avatar
0 votes
0 answers
6 views

access object paratamters node.js

I am logging a response that I get from the server after sending a post request, and it looks like this: {"output":"basic question #1. how do I calculate the area of a rectangle based ...
user avatar
0 votes
0 answers
5 views

Simple peer ice connection failure randomly after connection is established

I am using simple-peer to connect clients to my server. Connection gets established, data get transferred, everything works fine, but an errors occurs and crashes the server randomly while running. I ...
user avatar
  • 98
0 votes
0 answers
9 views

Mongose findOneAndUpdate don´t update and don´t throw an error

i have a two documents < Users and Poles > stored in my database on mongodDB Cluster . so basically a poles act like a team of Users . what i want is every time when a user want to join a pole ...
user avatar
0 votes
0 answers
10 views

Setting field in superclass isn't propagated to subclass

In an effort to reduce boilerplate in my constructors, I have an abstract class implementation that tries to set fields on the implementing class. A simplified version is below. The problem is that in ...
user avatar
  • 582
0 votes
0 answers
4 views

Getting error installing truffle on windows

gyp info it worked if it ends with ok npm ERR! gyp info using node-gyp@8.4.1 npm ERR! gyp info find Python using Python version 3.10.4 found at "C:\Users\DEEBN\AppData\Local\Programs\Python\...
user avatar
0 votes
0 answers
12 views

How to overwrite a file in cloudinary when it has the same name in nodeJS?

I'm trying to send a file to cloudinary, but if there is a file with that name, replace it. I'm trying everything with the parameters but nothing works, not even sending with the same file name or to ...
user avatar
0 votes
0 answers
11 views

How to deploy nodejs Azure function to azure with docker?

This is my first time playing with azure. I have a simple tool written which has to fetch some data from the postgres db, and send it to a MS teams channel. All my files are in a simple folder like ...
user avatar
  • 657
1 vote
0 answers
6 views

GLIBC_2.27 not found while installing Node on Amazon EC2 instance

I'm trying to install Nodejs on Amazon linux machine, I'm following this documentation to install node https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-up-node-on-ec2-instance....
user avatar
  • 139
0 votes
0 answers
10 views

Removing terminal color formatting from text in stdout [duplicate]

This is a follow-up from this post here: tail command not working with nodejs exec command I finally got the log file output I want but the new challenge is that the formatting from the output that ...
user avatar
  • 609
-5 votes
1 answer
22 views

I am unable to use .send

For some reason every time I try to use the .send command it doesn't work let messageEmbed = await embedChannel.send(embed); that is my code (messageEmbed is supposed to pickup the channel name from ...
user avatar
0 votes
0 answers
9 views

MS Teams Bot -- Is it possible to invoke a botMessagePreview from a task/submit activity as opposed to from a composeExtension/submitAction activity?

I am building a messaging extension in Teams that uses task modules and sends adaptive cards. I want to invoke the same task module from both a messaging extension command and from a button on an ...
user avatar
  • 36
0 votes
1 answer
23 views

select single document with minimum value $Min mongodb

I have made several efforts to select a single specific document that contains the minimum value from the database. let Lowestdate = await BTCMongo.aggregate( [ // { "$...
user avatar
-1 votes
0 answers
18 views

Why is the output the same when I use different encodings on Node.js using fs.readFileSync()?

I am trying to understand why when I use the readFileSync method and use different encodings (for example utf-8, hex, ascii) I have the same output on the console and when I dont pass any specific ...
user avatar
0 votes
0 answers
5 views

Set browser resolution for CircleCI cimg/node:lts-browsers

I'm using cimg/node:lts-browsers in CircleCI to do some UI automation tests with TestCafe. However, the default browser resolution is pretty low, how do I change the resolution to something like ...
user avatar
  • 565
1 vote
1 answer
12 views

tail command not working with nodejs exec command

I'm writing a quick test script that uses the tail command to monitor output that is added to a log file. When I execute the tail command directly in the console (I'm using OpenWRT), it works fine as ...
user avatar
  • 609
0 votes
1 answer
31 views

Merge two objects but not all properties

I am struggling to merge two objects the way I need them using Node.js express and mongoDB. Below you will see both initial objects. Obj1: { "name":"max", &...
user avatar
-1 votes
0 answers
14 views

How do I get the POST data from a netlify serverless function?

Here is the code for my server which works fine. I am trying to achieve this with netlify's serverless functions which I have pasted further below. CODE ON STANDARD SERVER-HEROKU const ...
user avatar
0 votes
1 answer
10 views

I am trying to make a discord.js discord bot and I am getting the error: TypeError: interaction.isCommand is not a function

I am making a slash commands and keep getting the error TypeError: interaction.isCommand is not a function. I am using discord.js version 12.5.3. It says that it should work and I have seen a few ...
user avatar
0 votes
1 answer
13 views

How to search the database so that it does not show certain things (I do not know how to write it)

Discord.js 13.6.0 | Node.js 16.14.2 | Mongoose 6.2.3 I want to do so that my bot searches the database to see if the guild should be removed or added Example I have 524 documents and 523 guilds I want ...
user avatar
-1 votes
1 answer
15 views

What is the best method to update small records from a big database?

I have a database which contains all the data from a CSV that I downloaded from a botanic website, and I want to it always updated based on the version of this CSV. My problem is that the CSV is ...
user avatar
-3 votes
0 answers
17 views

Can You Help Me With This Error Please? Çözemedim [closed]

Help Me Please Can You Help Me With This Error Please? Error Code: https:// paste.ofcode .org/9X2pJ5hGc9CncP7xjPVcHu https://www.youtube.com/watch?v=slL_nG1i1bs&feature=youtu.be
user avatar
0 votes
1 answer
8 views

JsonWebTokenError: jwt malformed when pulling from mySQL

For context, I'm trying to send a one time link to the user's email as a reset password link that will take them to the reset password page if the jwt token is successfully verified. I followed a ...
user avatar
  • 101
0 votes
0 answers
6 views

SlashCommandBuilder option to add file attachment (addAttachmentOption). Is there a way to get the image sent?

I'm following the discord guide (https://discordjs.guide/#before-you-begin) for making a bot, and I was able to set everything up fine. But I tried to make a slash command where the user attaches an ...
user avatar
  • 1
-1 votes
0 answers
31 views

Javascript - Array only returns the most recent entry

app.post("/search", async (req, res) => { const result = req.body.userInput; const arrayOfSearchResults = []; // initialize the array arrayOfSearchResults.push(..result); // ...
user avatar
0 votes
0 answers
13 views

How require websocket on rendered file in public js / Node.js

my app.js route and public is working my controller js const WebSocketServer = require('ws').Server; const tvindex = function (req, res) { res.header('Access-Control-Allow-Origin', '*'); res....
user avatar
0 votes
0 answers
5 views

Storing and downloading pdf files from mongoDB using Node.js

I am using NodeJs, mongoose, ejs I want the user to be able to upload his CV (Less the 16 MB) as a pdf file, then the admin to be able to download the pdf or view the CV on the website. I did the ...
user avatar
  • 11
1 vote
1 answer
20 views

Fetch records that does not exists in collection in given array - mongodb

I have an array of student ids. I want to get those records that were not found from the given array. Students array: var studentIds = [1, 2, 3, 4, 5]; Records in collection: [{_id: 1, name: 'John'}, ...
user avatar
  • 1,881
0 votes
0 answers
7 views

Downloading files using basic ftp

I'm trying to download a file from an ftp server using basic-ftp library, I believe there's something wrong with the encoding. the file downloads incorrectly and I'm not sure how to fix this. const ...
user avatar
0 votes
0 answers
11 views

TypeError: Cannot read properties of undefined (reading '0') in NodeJS

I have the TypeError: Cannot read properties of undefined (reading '0') with game_id: result.data[0].game_id, warning in my terminal, What is weird is that the console.log("result ", result);...
user avatar
  • 1,829
0 votes
1 answer
17 views

ExpressJwt is not a function

I'm trying to write user authorization middleware. I use this function to validate and verify authorization later on. I have done yarn add express-jwt. auth.js code: const SECRET = 'secret-message'; ...
user avatar
  • 1
1 vote
2 answers
14 views

POST Request Basic Authorization - Not Working for Battle.net API in Node.js

I have formatted an axios post request as follows: var config = { method: 'post', url: 'https://us.battle.net/oauth/token', headers: { 'Authorization': 'Basic '...
user avatar
  • 13
0 votes
0 answers
4 views

RabbitMQ Node js pattern for handling connections

I am curious with approche is better to handel connection for producer. Creating a class as singleton and keeping a connection open or create connection and after sending message to queue closing it. ...
user avatar
  • 21
0 votes
1 answer
8 views

How res.redirect() is different than res.render() after saving a data entry in mongoose despite both are having same code?

I have a HTML form where data is submitted to mongoDB using express and mongoose. After submitting data to mongoDB, client is shown up with the table containing all the records which is be done by ...
user avatar
-1 votes
0 answers
14 views

Node.js middleware create a proxy service

I'm trying to code a proxy service like iproyal. But I couldn't figure out the rotating proxy logic. My proxy database is ready. Each time I return a different proxy, but if I return these proxies ...
user avatar
0 votes
1 answer
10 views

How to bulk insert with a select subquery

I'm using Sequelize in my project but I'm facing some trouble to translate in simple query into Sequelize. In addition, I'm looking for a way to bulk insert this query. The query: INSERT INTO ...
user avatar
0 votes
1 answer
8 views

How to use `firebase-admin` inside firebase functions using ES2015

Nothing I do here seems to work, I can't find an example anywhere that actually seems correct This: import { initializeApp } from 'firebase-admin/app'; Throws: Error [ERR_MODULE_NOT_FOUND]: Cannot ...
user avatar
0 votes
1 answer
9 views

Retrieve two foreign keys nodejs sequelize

I have a route and I want it to send two primary keys as foreign keys to my orderline table. I have three tables a customer, address and orderline table. an orderline has one customer and one address ...
user avatar
  • 41
0 votes
1 answer
18 views

How to trigger AWS SQS to Lambda after get 5 messages

This is my first question. I'm trying to connect nestjs to Aws sqs and get a batch of message. But, every try i get only one message. Here i'm ussing SQS-Consumer const consumerApp = Consumer.create(...
user avatar
0 votes
0 answers
10 views

401 Unauthorized error when making axios request

I am using axios to make different GET and POST requests to a third-party API that requires a username and password login to access the data. I have tried several approaches to make this work but I ...
user avatar
0 votes
0 answers
12 views

Firebase: Cloud Functions + Storage Read File

I am currently writing a function in Firebase Functions to be called within my Firebase mobile application. I have the code to call the function, but I do not know how to get this function to interact ...
user avatar
0 votes
0 answers
9 views

Should I run "apolloServer.executeOperation" on Next's "getServerSideProps"?

I'm trying to figure out the best way of running GraphQL queries in the getServerSideProps of a Next.js app. Since the GraphQL server is running on the same Next.js instance, the obvious solution is ...
user avatar
  • 52.2k
0 votes
2 answers
36 views

Async function doesn't return in React app [duplicate]

I have an async function in a file (someFile.js) in my React app and I want the returned string from that function (someFunction) to be inserted in the webpage when it's finished. The problem is with ...
user avatar
0 votes
2 answers
24 views

TypeError: Cannot convert undefined or null to object: point me in the right direction

I've found many issues and solutions to this online but I'm kinda new and tbh I couldn't make it work. It's probably pretty silly but yeah, I need help :) The error: TypeError: Cannot convert ...
user avatar
-1 votes
0 answers
7 views

extract all pages from google book using volume Id

is there any way to extract all pages from google book? without limit? for example this url: https://www.google.com/books/edition/JavaScript_A_Beginner_s_Guide_Third_Edit/U69Hzz2jLPUC?hl=en&gbpv=...
user avatar
0 votes
1 answer
24 views

Cannot GET routes other than "/" express

I'm trying to create a web app with the MVC pattern and express in node.js. This is my project structure: project structure image app.js: let express = require("express"); let hbs = require(&...
user avatar
0 votes
0 answers
16 views

Update array inside document with Mongoose [duplicate]

I have a MongoDB document that has an array inside of it: name: 'This List' items: [ ObjectId('....'), ObjectId('....'), ObjectId('....'), ObjectId('....'), ObjectId('....'), ObjectId('....'), ...
user avatar
0 votes
0 answers
5 views

minify heroku slugs on build terser

I recently used "heroku run" and looked around inside my package.json nodejs app, the slug is NOT minified in /node_modules . I am using the standard "heroku/nodejs" buildpack. ...
user avatar
  • 11
-1 votes
0 answers
12 views

Programmatically how to transfer ownership of Googlesheet from service account to my own account gmail? [duplicate]

I'm trying to create a GoogleSheet through the Google API. While we created automatically the googleSheet in server-side, I needed to auth to google with an account service (https://developers.google....
user avatar
  • 41

1
2 3 4 5
8539