Category "node.js"

cURL request with 'User-Agent' header works fine but doesnt work in node with axios/fetch/https

When i make a curl request to a website for webscraping with the header "User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:93.0) Gecko/20100101 Firefox/93.0" it wo

How will I get the content ie the title of a tag while web scrapping with puppeteer?

I am following this tutorial. https://www.digitalocean.com/community/tutorials/how-to-scrape-a-website-using-node-js-and-puppeteer I am trying to learn how to u

difference between mongodb and mysqlhow to firebase deploy

I wanted to use the mongodb database, but I noticed that there are two different databases with either their own website and installation methods: mongodb and m

TypeError: Cannot read properties of undefined (reading 'webContents') Electron.JS

Im trying to make an event on keyPress (keyDown) (In electron) but i get this error. TypeError: Cannot read properties of undefined (reading 'webContents') He

How to set req.body for a video tag?

I would like to set a req.body parameter for the request that the video tag is requesting. The Video tag requests at a certain route to request a video stream.

ImageMagick lambda layer aws SAM

I have the following template.yaml from a SAM application AWSTemplateFormatVersion: "2010-09-09" Transform: AWS::Serverless-2016-10-31 Description: > image

why am I getting this "Cannot find module server.js"?

I had a Traversy Media tutorial on how to learn the MERN stack that I was following. I had the first part installed on my desktop and it was working properly. o

node + ts-jest + ESM, jest.mock doing nothing

I am using ts-jest with ESM imports on nodejs. The problem is that my jest.mock is not working, it is not mocking. import { jest } from "@jest/globals"; jest.m

"Not Authorized to access " error on create mutation + GraphQL

I'm running the below GraphQL query to create data on dynamodb table, but gets the response with "Not Authorized to access createClient on type Client" Why this

Mock Injected Twilio Service in Unit Testing Nest.js

I have a problem with overriding provider/setup module testing in nest.js application for testing. Module file: smsModule.ts: import { TwilioService } from './t

Lodash-es with Typescript and Webpack module error

I want to use lodash-es to be able to import only the functions I need, but I get an error. import { camelCase } from "lodash-es"; //... console.log(camelCase('

how can i get the specific info about a user

i'm working on a web app in which a user can create an address when logged in, how can i get the current logged in user address which was created by the user th

DiscordJS MessageManager is a circular dependency

I try to get a message by id in discord.js, but returned MessageManager is a circular dependency and I cannot access any of it's properties. console.log(cha

fuse.js takes 10+ seconds with semi-long queries

I have a JSON database with 27k+ entries, and I'm using fuse.js to search through them. Each entry has about 500 characters of text in it. When I search for som

How to Unit Test a method inside a module in NestJs (Jest)

I'm adding tests on a project and improving coverage. I would like to know how can I test a method defined inside a module definition in NestJs. import { Middle

Sending a signed transaction is not working - Web3 / Node.js

I am trying to send an Ethereum transaction using a private key in Node.js using the web3 library. I have tried many pieces of code but I get the same issues ev

How to update PATH environment variable while deploying in Cloud Foundry

I want to deploy my Node.js application in Pivotal Cloud Foundry using manifest.yml. I need to update the PATH variable of the container before the application

How to listen for messages from SQS in nodesJS?

I am trying to use SQS the same way we used RabbitMQ or Kafka where we set up a listener. But I dont see a way to setup a listener for SQS anywhere in their doc

DiscordJS v13 send to specific channel

So I am trying to send an embed to a different channel than the command was used in as a log channel how ever I have tried a few different methods however where

Jest Testing - mockReset does not clear the already set values

I have a lambda which calls an interface. Am trying to mock the functions imported from the interface. In each test case, I have to mock different values. When