Skip to main content
Filter by
Sorted by
Tagged with
6 votes
3 answers
7k views

After Heroku restart: pnpm: Error: Cannot find matching keyid [closed]

My Heroku-hosted node app stopped working this morning at 6am. In the Heroku console I found a message "Dyno restart" at that time. At the same time, memory usage dropped to 0. Apparently ...
de.'s user avatar
  • 8,527
12 votes
2 answers
635 views

Why does throwing an error in a not-yet-awaited async function call terminate node.js?

async function delay(ms) { return new Promise(r=>setTimeout(r,ms)) } async function fail(ms){ await delay(ms) throw new Error("kek"); } async function ok(ms){ await delay(ms) ...
Andrey's user avatar
  • 121
5 votes
2 answers
227 views

Share mongoose connection between repositories in a TypeScript monorepo

My MonoRepo structure Full example and testable code is here: https://gist.github.com/SohamRoyNoel/c50fac02c0f07d3816e8f31797478013 Intent: I want to bring out database from app1 and app2 level and ...
Nick's user avatar
  • 321
3 votes
2 answers
90 views

How to correctly unref a V8 substring ("sliced string") from its source string

I spent a better (or rather worse) part of today hunting a bug that caused Node.js engine to randomly run out of memory when searching a giant log file line by line by regex. The cause was that I kept ...
Tomáš Zato's user avatar
  • 53.3k
4 votes
4 answers
161 views

Is `console.log()` considered a side effect in JavaScript?

I was learning about side effects in JavaScript, and I came across the idea that console.log() is considered a side effect. However, I'm not entirely sure why. For example, in the following function: ...
Rao Imtinan's user avatar
-2 votes
2 answers
92 views

Why am I receiving TypeError: . . . not a function? [closed]

test1.js: const myFunc = () => { return "Hello World!"; }; module.exports = myFunc; test2.js const test2 = require('./test1.js'); console.log(test2.myFunc()); When I run: $ node ...
Crowdpleasr's user avatar
  • 4,028
2 votes
2 answers
146 views

How to extract text from between any given pair of spans?

I am trying to use Cheerio and Node.js to extract text from an interesting bit of HTML. Let's say I have the following HTML: <p> <span class="sectionno" id="s1">1</...
Adam D's user avatar
  • 2,247
0 votes
1 answer
177 views

Neither WebCryptoAPI nor a crypto module is available in bcryptjs v3.0.0

I recently upgraded bcryptjs to version ^3.0.0 in my Node.js project and encountered the following error while trying to hash a password: const bcrypt = require("bcryptjs"); const password =...
Nijat Aliyev's user avatar
0 votes
2 answers
182 views

Bruno is not able to identify fs module from nodejs [closed]

I have installed Bruno and imported the collection. I have set the $PATH to where node.js is installed. export PATH="/opt/homebrew/bin:/usr/local/bin:/opt/homebrew/bin/node:$PATH" When I ...
P H's user avatar
  • 344
-4 votes
1 answer
76 views

Cypress on headless mode not able to resolve promises through await calls

I am developing an API testing backend using Cypress with cy.request. I am aware that cy.request natively uses built-in promises (Cypress.Chainable), so there is no need to handle it with JavaScript ...
rangana dilhara's user avatar
1 vote
1 answer
164 views

NodeJS 22.13.1-r0 breaks Forego action on Alpine container

I am using the asciidoctor/docker-asciidoctor:1.82 container which is built on top of alpine:3.21.2. With this I built a Forgejo action where I install node into the container using apk add nodejs npm....
Crown's user avatar
  • 361
0 votes
2 answers
99 views

How do I determine the algorithm of a public key in nodejs?

Given a public key of the following form (invalidated in example), how would I find the algorithm used in Node.js, using the crypto package? -----BEGIN PUBLIC KEY----- ...
Andre M's user avatar
  • 7,554
1 vote
3 answers
161 views

Lambda@edge error handling with async/await (nodejs)

I've been creating lambda@edge functions to do various actions on a viewer request event from cloudfront. Most examples I can find seem to use callbacks but I wanted to use the async/await pattern ...
Omiron's user avatar
  • 377
1 vote
2 answers
72 views

Why does my pool.query return "undefined"?

The first query returns rows: (async () => { const {rows} = await pool.query('SELECT * FROM accounts'); console.log(rows); })(); This query returns "undefined": (async () => { ...
Paul's user avatar
  • 111
-2 votes
2 answers
128 views

How to make a background bash script pause while an npm build runs?

I'm setting up a new method of deploying my personal react website, which is using vite for bundling. My idea is: I push un-bundled changes from local to remote repo a web hook informs my server (...
Mike Willis's user avatar
  • 1,512
0 votes
1 answer
111 views

Azure Function deployment from GitHub action is failing in Azure/functions-action

I have created an Azure function with Node in VS Code and published it to Github. In GitHub, I have created a build-and-deploy action YAML: name: Deploy Node.js project to Azure Function App on: ...
Michael S. Scherotter's user avatar
0 votes
3 answers
97 views

Jest mock singleton instance

service.js this file defines a Service class with a constructor that initializes a value property and a getValue method that returns this value. The file exports an instance of the Service class. ...
Alex's user avatar
  • 31
-1 votes
0 answers
120 views

Nested async-await with promise all loops behaviour not understandable [closed]

I need to group specific consecutive duties of each user based on certain flags. For instance, in my case, I have duty flags with values of "s" and "v." If I have two consecutive ...
vikrant chauhan's user avatar
2 votes
2 answers
88 views

Using SQL `IN` operator with DatabaseSync in Node (sqlite)

Using DatabaseSync in Node, I can do the following: const stmt = conn.prepare(`select name from people where id = ?`); let res = stmt.get(100) However, I want to select a number of records at once ...
mydoghasworms's user avatar
0 votes
1 answer
78 views

Hide source code of Next.js and Nest.js app on client's device/server

I have this requirement that I would deploy the application (Our company's) to a client device/server, but I don't want to expose my codebase as there is a potential issue like rebranding or ...
Karl Cusi's user avatar
-1 votes
1 answer
128 views

Efficiently utilizing puppeteers headless browser's in google cloud?

I have a nodejs codebase deployed on google cloud, using an ubuntu image. This code will open a headless browser using puppeteer, render some HTML and save an image. This is currently taking about 4-6 ...
Mike K.'s user avatar
  • 606
2 votes
1 answer
76 views

Can't resolve 'querystring' in old dependency

I have an old React app which I'm trying to run locally, but I encountered some issues regarding querystring and pollyfils. Here are my files: packages.json: { "name": "test-immersion&...
terett's user avatar
  • 463
-4 votes
1 answer
48 views

Axios api post request not working after 7th try [closed]

My code is set to post a axios request after a set period of time. Every time it gets to the 7th iteration, no post request is being made and recieved by the backend. its not a rate limit problem or # ...
Byrie's user avatar
  • 29
1 vote
2 answers
64 views

How do I render .ejs files without having to create a route for each one?

Server: import express from 'express'; const app = express(); app.set('views', './public'); const PORT = 3002; app.get('/', (req, res) => { res.render('index.ejs', { title: 'Page Title'}); }); ...
Paul's user avatar
  • 111
3 votes
1 answer
59 views

Is there a way to insert custom data in Obsidian Internal Link result?

I'm developing an Obsidian plugin and want to augment the default internal link suggestions (the ones that appear when I type [[ ) with some custom data. Specifically, I'd like to merge my custom ...
Dan Sto Domingo's user avatar
2 votes
1 answer
96 views

Error when build NestJS project: util_1.isObject is not a function

I am rebuilding a NestJS project that I could run in 8 months ago, with base on the Dockerfile below FROM node:alpine as base WORKDIR /usr/src/app RUN apk add --no-cache ffmpeg COPY package*.json ....
bao.le's user avatar
  • 174
0 votes
2 answers
56 views

How to change environment variables at runtime in a SvelteKit App using the Node adapter?

I have a SvelteKit app that I am using with the Node adapter to run as a Node.js server. I would like to change the environment variables at runtime so that I can package the app into a container and ...
Sniphs's user avatar
  • 37
0 votes
1 answer
60 views

SequelizeConnectionRefusedError: Unable to connect to PostgreSQL Database in Node.js

I'm working on a Node.js backend using Express and Sequelize to connect to a PostgreSQL database. However, when I run node index.js, I get a SequelizeConnectionRefusedError. My index.js file: import ...
Sourabh Singh Bais's user avatar
0 votes
1 answer
81 views

Uncaught SyntaxError: The requested module does not provide an export named 'Redis' in ioredis

I am using ioredis in my Node.js + Express project with ES modules ("type": "module" in package.json). When I try to import Redis like this: import {Redis} from "ioredis";...
Rakesh Nagarkar's user avatar
3 votes
0 answers
114 views

Usage of CSP /nonce on Electron app with Node.js

I'm making a desktop application with Electron and Node.js, in which I'm trying to implement CSP /nonce. So far I have developed a script that should generate the content security policy: const crypto ...
Francisco IA Lover's user avatar
0 votes
0 answers
88 views

How to send data from react js to a node js server?

So this is my server.js: const express = require("express"); const multer = require("multer"); const cors = require("cors"); const admin = require("firebase-admin&...
Gabi Moldovan's user avatar
0 votes
2 answers
65 views

okhttp websocket immediately fails after connection

I've been tryin to get websockets working in my Android app. I am using OKhttp websockets, an apache proxy and a node server. I finally got a connection, but it connects and then within a few seconds ...
Neglected Sanity's user avatar
0 votes
1 answer
80 views

How to get filepath after dropping file?

I'm trying to build a React + Electron app that supports file drag and drop. The goal is for users to be able to drag files into a box, and for the app to retrieve the full file path from the user's ...
Martin's user avatar
  • 1,582
1 vote
1 answer
48 views

Can I access the results of an assertion or 'it block' and write it to my own report object, in Cypress?

For various reasons I have a custom report object for my Cypress tests. I alter what the report result is for each step (or it block) using conditonals, eg: it(`Checks for FAQ schemas`, () => { ...
MeltingDog's user avatar
  • 15.5k
0 votes
3 answers
69 views

getting NaN value some times and some times not

I get NaN value when I try to show the value of (item.total_amount,item.price,item.addtional_price) in ejs page but when I debug the variables some time I get the value and some time not!! this is the ...
Ali Alariqi's user avatar
2 votes
1 answer
86 views

NextJS (15.1.7): ReferenceError: XMLHttpRequest is not defined

ERROR DESCRIPTION Hey everyone! There is code snippet of my frontend: 'use client'; import Image from "next/image"; import { doSomething } from "./serveractions/do-something"; ...
Dima Vavilov's user avatar
2 votes
1 answer
116 views

What does this mean "Error: Upgrading from 1st Gen to 2nd Gen is not yet supported

What does this mean? Error: Upgrading from 1st Gen to 2nd Gen is not yet supported. See https://firebase.google.com/docs/functions/2nd-gen-upgrade before migrating to 2nd Gen. We'd like to be able ...
Ralph Yozzo's user avatar
  • 1,142
-4 votes
1 answer
50 views

"Insert record if not present " logic is not working for some request if we hit 100 request per second in Node Express Application

I have made an POC application, where the requeirment is to insert the reocord if ther is no record present in the db. This logic is not working if we hit 100 request per second with same data. For ...
Chinmoy Samanta's user avatar
-4 votes
0 answers
87 views

array?.map (if array is undefined) [closed]

const arr = [{ component_name: 'apple', component_part: [{ part_no: 1, part_name: 'xxx' }, { part_no: 2, part_name: 'yyy' } ] }, { ...
BdPk's user avatar
  • 33
0 votes
2 answers
69 views

How to convert a Web API ReadableStream to a Node.js stream.Readable?

How can one convert a Web API ReadableStream (implementation of the WHATWG Streams standard) to a Node.js stream.Readable? This is the reverse question of: How to convert a Node.js stream.Readable ...
Borewit's user avatar
  • 923
1 vote
1 answer
65 views

Express and ejs: using ejs with other file extensions: require not working

According to the docs, the line: app.engine('html', require('ejs').renderFile) should get express to process .html files as if they were .ejs which was my first simple test to have ejs work with ...
Paul's user avatar
  • 111
2 votes
0 answers
72 views

How can I efficiently process large PostgreSQL datasets in Node.js without high memory overhead?

I have a Node.js application that interacts with a PostgreSQL database containing millions of users. For a specific feature, I need to fetch around 100,000 users based on a criterion (for example, ...
Nightcrawler's user avatar
  • 1,081
0 votes
0 answers
89 views

NPM failing to install DuckDB

When i run NPM install on a project that is trying to install duckDb version 1.1.3 i get the following error npm error code 1 npm error path C:\Program Files (x86)\SDADS\WebApp\backend\node_modules\...
danCodes's user avatar
1 vote
1 answer
62 views

CORS, transmitting JWT via cookie using HTTPOnly

Problem: When I send a JWT token via cookies directly to http://localhost:8000/api/profile, it works fine, and I receive user data. However, when I pass the token via a second microservice, I get a ...
Mikhail's user avatar
  • 15
-6 votes
1 answer
70 views

Without variable works, with variable error [closed]

I have this NODE JS code, the problem is that when I try to pass a variable from “mynew” to ‘userPrompt’ then ai gives the error “no body”. If I just substitute the value without the variable, ...
evgenij's user avatar
1 vote
3 answers
46 views

Docker build failure in Jenkins Ubuntu

I am not sure if I should be asking this question here but I am giving it a try. I have Dockerfile that looks like the following. Some parts of it are omitted here for brevity. # Stage 1: Install ...
Thabo's user avatar
  • 1,475
3 votes
1 answer
80 views

Express JS API query variable with parameters for EXEC stored procedure

I am working with the API which will serve as my data access layer in my project architecture. This is the original form of my API query setup: const pool = await poolPromise; const request = pool....
DevQtPH's user avatar
  • 167
0 votes
0 answers
72 views

electron add statusbar to app like default top bar

I have a dafault top bar build with template like this: _setupMenu() { const template = [ { label: 'File', submenu: [ { role: '...
Francisco IA Lover's user avatar
2 votes
0 answers
77 views

Bun uses wrong path for css chunk files. How to fix path?

Bun uses wrong path for CSS chunk files. How to fix path if frontend is in different directory than server? I just started using bun to deploy a fullstack Dev Server while following bun.sh/docs ...
redcast's user avatar
  • 21
0 votes
2 answers
67 views
+300

Error uploading image to Cloudflare from Buffer with node js and FormData

I am trying to upload an image to Cloudflare from a buffer. I am using the following code: const cloudflare_url = `https://api.cloudflare.com/client/v4/accounts/${process.env.CLOUDFLARE_ACCNT_ID}/...
Cyril Gaillard's user avatar

1
2 3 4 5
11