All Questions
Tagged with node.js postgresql
5,996
questions
-2
votes
1
answer
83
views
What this mean : "TypeError: Cannot read properties of undefined (reading 'toLowerCase')" [closed]
When I submitting answer then this line apprise in page and console:
TypeError: Cannot read properties of undefined (reading 'toLowerCase')
at file:///***/index.js:48:31
Here is my code :
app.post(&...
0
votes
0
answers
34
views
How can I use the concat operator (||) in Sequelize for ilike comparison?
I'm working on an express.js project, using Sequelize on a postgres database, and we have the following query:
SELECT *
FROM Client
WHERE first_name || ' ' || last_name ILIKE '%search term%'
I'm ...
0
votes
1
answer
84
views
'pg' package TypeError: Cannot read properties of undefined (reading 'then')
When I try to run then function on it, it will return this error
TypeError: Cannot read properties of undefined (reading 'then')
at Object.\<anonymous\> (/app/src/index.js:52:2)
at Module.\...
0
votes
0
answers
34
views
Socket.io events in React.js and Node.js not being triggered
I'm building a chat application in React js and Node js. The events that I have written in React.js and Node.js do not seem to be triggered. I can login and see data in both the browser and the ...
0
votes
1
answer
33
views
How to Sort Users by Their Last Sent Message Timestamp in NestJS with TypeORM and PostgreSQL?
I'm working on a NestJS application with TypeORM and PostgreSQL, and I need to fetch a list of users sorted by the timestamp of the last message they sent.
I have two entities, User and Message, ...
0
votes
1
answer
37
views
Sequelize doesn't works well with tests
I have some tests and, if I run only that test individually, it works normally, but if I run all the tests, it keeps printing No description found for "Users" table. Check the table name and ...
0
votes
0
answers
19
views
Most efficient way to do a "bulk update" in Sequelize
We have an aws serverless node project, and we're using Sequelize to access our Postgres database.
There's an endpoint that updates several rows, each with it's own data (right now is limited to 50 ...
0
votes
0
answers
16
views
npx sequelize-cli db:migrate ERROR: Cannot use import statement outside a module
Recently, I've been working on a project with Node.js, TypeScript, Sequelize, and PostgreSQL. I want to make some migrations to add data just to test the endpoints.
But when I run the following ...
0
votes
0
answers
34
views
sequelize-auto conf overwritten
I'm trying to use sequelize-auto to create models for my postgres db. I'm following the docs and have this config.js:
const path = require('path');
const output = path.join(__dirname, "./models2&...
0
votes
1
answer
17
views
Supabase GIN index creation errors
So essentially I have a Jobs table with around 70000 records and for my NextJS app I need to perform full text search on the description column, when I run the query to create the index within my ...
0
votes
0
answers
14
views
Executing queries on Postgres pool directly instead of fetching an idle instance
I'm trying to feather out some misunderstandings of how I've been querying with Postgres in my application.
Most of the documentation illustrates an approach like so:
const pool = new pg.Pool({
user:...
-1
votes
0
answers
43
views
Throwing an error when opening the project, because of pg import
This line const { Client } = require('pg'); causes my project to throw errors. The import just mentioned, is found in my file called Logic.jsx.
In another file called Members.jsx, I am importing the ...
0
votes
1
answer
94
views
Best alternatives for a fast search on a big table on a Postgres database?
We have an Express API that connects to a Postgres database using Sequelize.
One of our endpoints returns a list of sales, which accepts different query parameters like page, column order, filters, ...
0
votes
0
answers
108
views
Nuxt 3 & Postgresql: Cannot access 'renderer$1' before initialization
I am working locally on an application built with Nuxt.js 3 and using Postgreql. I am finding that I am running into the following error message: Cannot access 'renderer$1' before initialization
1: No ...
0
votes
0
answers
23
views
Optimizing Sequelize Synchronization Time with PostgreSQL in NestJS
I'm working on a project using NestJS and Sequelize with a PostgreSQL database. My setup includes around 85 tables, and I've noticed that setting synchronize: true in Sequelize takes about 45 minutes ...
0
votes
0
answers
55
views
The revisions freeze when a new revision is created - Azure Container Apps [closed]
It's my first publication so excuse me if I skip any rule, we will progress along the way ;)
My problem:
I have an application container that in opportunities when a new revision comes on the way it ...
0
votes
0
answers
15
views
Creating a GUI/PSQL based postgre SQL table editor
I am planning to create a GUI and PSQL based postgre SQL table editor for my project. The front end is React and Backend is Node JS. Now in order to create the table, I can simple provide user with a ...
-1
votes
1
answer
30
views
Error Selecting data in Postgres using node
This is my get function
const navigate = useNavigate();
const [userData,setUserData] = useState({});
useEffect(()=>{
if(Cookies.get('auth') !== 'AUTHENTICATED'){
...
0
votes
0
answers
41
views
Postgres copy to STDOUT hangs indefinetly
I have a script that runs COPY on postgres to STDOUT. This stream is consumed by nodejs into a readable. This readable is passed to pipeline which writes to a csv file locally. I am using nodePG and ...
0
votes
0
answers
48
views
Pool to postgresql nodejs
Perhaps someone has already encountered it and will be able to tell. Unfortunately, I could not find at least a small part of the information.
I know can use third-party libraries, including pg, on ...
0
votes
0
answers
20
views
How can i generate the arrow function format typeorm migration file?
when ever i am generating migration file i am getting this kind of format
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "transaction&...
0
votes
1
answer
24
views
How to Properly Create the Data Architecture for a PERN Stack Application?
I'm building a web application using the PERN stack, and I'm looking for best practices on how to design the data architecture.
I just did a basic pernTODO in order to practice my postgressSQL skill a ...
0
votes
1
answer
53
views
Selecting Rows By Specific Column Data in PostgreSQL
I'm trying to build a recipe finder app (PERN stack) like SuperCook but I ran into some problems with my postgres table.
Short description of the desired result. I'd like the user to select some ...
0
votes
0
answers
15
views
How to Upsert Nested Relations in Prisma, using connectOrCreate? connectOrCreate doesn't update deeply nested relation
I'm working on an application using Prisma ORM with a schema that includes Profile, Contact, and SocialMedia models. I need to perform an update operation on a Profile, which should also handle ...
0
votes
0
answers
23
views
Sequelize Eager Loading Causing Connection / Pool Issues
I recently refactored code for getting posts from a Postgres database from this:
const getPostByPk = async (token, post_id) => {
const requestor_id = await verifyToken(token)
const post = ...
1
vote
0
answers
17
views
How to implement login and registration module in node and react with passportjs
I want to know like there is a three pages login registration and home now I want like before signup or sign in user should not be able to access home page now how to implement that like normally and ...
0
votes
0
answers
42
views
Nextjs and prisma: TypeError: Unknown file extension ".ts"
I am starting on the Nextjs world and i wanted to try the prisma ORM but i'm facing some errors.
So basicaly other thing what i am in doubt here is the fact that prior this erros i was getting another ...
0
votes
0
answers
57
views
Error Connecting to PostgreSQL Database in Multi-Container Azure Container Instances (ACI) Setup
I’m currently deploying a multi-container setup using Azure Container Instances (ACI) and I’m facing issues with connecting to a PostgreSQL database container from a Node.js application container. ...
1
vote
0
answers
34
views
Receiving TIMESTAMP instead DATE from POSTGRESQL DB to EXPRESS JS BACKEND
I am making a To-Do App. I use Express backend and Postgres DB to store users' data and tasks.
I have three tables in my DB:
users (id (primary key), username, password, name) => To store user ...
0
votes
2
answers
58
views
Where to save hashed passwords for user login? [closed]
I am designing a website for my company that will have a user log in page that will lead to a customized dashboard. I am currently, using PostgreSQL to store information in the back end of this ...
0
votes
1
answer
37
views
How to run a specific migration file using typeorm in node.js?
I'm currently working on a Node.js project using TypeORM with PostgreSQL. I have multiple migration files, but I want to run only one specific migration file instead of all pending migrations. Below ...
1
vote
0
answers
83
views
How to do Vector Embedding query in Kysely/PostgreSQL with pgvector?
Looking at https://github.com/pgvector/pgvector?tab=readme-ov-file#querying for inspiration, do you happen to know how to do a Kysely query for the embedding? I am new to vector embeddings and ...
0
votes
0
answers
18
views
How can i optimize my checkForConsistency function?
I have been given a task to optimize a function. I have done the following things to enhance the code like
Saving state of processedIds in case of failure and continuing from there
Fetching necessary ...
0
votes
1
answer
36
views
Sanitizing with pg-format vs parametrized / prepared statements
Having come from an era where trends pushed away from sanitizing towards preparing parameters, I was surprised to see this library that seems to push back the other way - to sanitizing on the client. ...
0
votes
0
answers
37
views
I get a Cannot POST /login error when i'm not sending a POST request to the /login endpoint
I'm building a web application where users can register and login using Node.js, Express, and a PostgreSQL database. However, I'm encountering an issue with my frontend and backend communication. When ...
0
votes
1
answer
104
views
Connect NestJS API in Cloud Run with Cloud SQL db
I have a NestJs API triying to deploy to Cloud Run but it fails at the moment it tries to connect to Cloud SQL. i'm using typeORM.
This is the config to connect the DB
import { Client, ClientConfig } ...
0
votes
1
answer
27
views
postgres database connected but table relations not found when running nodejs typescript api in a docker container
i wrote a basic api with typescript in nodejs which runs fine when started with the start script "node dist/index.js", but after dockerizing it, the database seems to have been connected ...
0
votes
1
answer
26
views
PostgreSQL connection with NodeJS and SSH-Tunnel: Always connection timeout
With a simple script I try to access a remote database over a ssh tunnel. I tried different configurations, but always at pool.connect()
Error establishing PostgreSQL connection: Error: Connection ...
1
vote
1
answer
183
views
Prisma ConversionError Unable to fit integer value '6484250528' into an INT4
I am trying to use prisma and postgresql to do a simple query, but the findUnique function throws the below error:
Error occurred during query execution:
ConnectorError(ConnectorError { ...
0
votes
0
answers
31
views
Sequelize - PostgreSQL timezone won't change
I can't use anything else but UTC when reading a Date datatype.
Here's my object to be added to PostgreSQL db:
{
"word": "test",
"wordLanguage": "eng",
...
0
votes
1
answer
78
views
NodeJs and Postgres-Connection terminated unexpectedly
I'm trying to connect my Node project to Postgres.
My server is running in the project.
In Postgres, when I execute a data retrieval command, it also return me the correct data.
But when he wants to ...
0
votes
0
answers
24
views
How to push prism db React
I'm working on a project where a build Reddit clone using react and I'm trying to connect my database but keep getting an error saying: Invalid params: invalid type: map, expected a string.
I'm ...
0
votes
1
answer
32
views
Problems with updating :sql_last_value
I want to synchronize data between postgres and elasticsearch for this I am using logstash.
This is how looks configure file for logstash
input {
jdbc {
jdbc_connection_string => "...
0
votes
0
answers
47
views
How can I run a subquery with leftJoinAndMap
Here are my entities
Channel Entity
@Entity({ name: 'channels' })
export class Channel extends BaseEntity {
@Index()
@Column({ name: 'topic', unique: true, nullable: true })
topic: string;
@...
0
votes
0
answers
32
views
OpenShift Deployment Issue: Result Page Not Reflecting Votes from PostgreSQL
I'm very new to OpenShift and I'm still learning. Since my local machine doesn't have enough resources for CodeReady Containers (CRC), I'm currently using the 30-day free trial of OpenShift Developer ...
0
votes
0
answers
152
views
Node.js failed to connect to postgres server
I'm trying to connect to my postgres (v16.3) database using a nodejs app (v20.15.0), both running locally but it throws an error.
import pg from 'pg';
const db = new pg.Client({
user: "...
0
votes
1
answer
87
views
Sequelize is not returning all rows for given query
I've got the following sequelize models:
import { DataTypes, Model } from 'sequelize';
class A extends Model{}
A.init {
name: DataTypes.STRING,
start_date: DataTypes.DATE,
end_date: DataTypes....
0
votes
1
answer
102
views
Mikro-orm: Update with select statement
I am trying to update a table column that is dependent on one more table. The sql query is working fine on database and couldn't figure out the mikro-orm query for that. Below are the sql and mikro-...
0
votes
0
answers
47
views
What is an optimal way to create unique human readable values in postgres?
I have an orders table. For simplicity sake, I'll just include the columns that matters.
id
number
uuid1
ABC123
uuid2
DEF456
The number column is unique but it is not auto-generated by the ...
2
votes
0
answers
203
views
How do you use process.env in SvelteKit?
I'm trying to connect a postgresql database with SvelteKit via Drizzle, using their nodejs package. I'm having a problem importing the database environment variables into the Drizzle config.
At first, ...