12,428 questions
0
votes
1
answer
64
views
Property 'VECTOR' does not exist on 'DataTypes' in Sequelize with pgvector
I am building a RAG application using Node.js, Sequelize, and PostgreSQL with the pgvector extension. I have successfully enabled the vector extension in my database.
I am now trying to create a ...
1
vote
2
answers
106
views
Sequelize transaction stays open too long during API calls, causing connection pool exhaustion
I'm facing an issue with Sequelize(postgres) transactions in a high-traffic Node.js/Express app. I have a flow like this:
async function createPayment(data, trnx) {
// Save in DB within transaction
...
3
votes
1
answer
101
views
Getting SQLite Syntax Error when saving model in Sequelize.js v7
So, I'm trying to learn full stack by making a list app, and I'm using
Sequelize.js for the database. So far I've got User and List models. I
recently switched to Sequelize v7.0.0-alpha.47. I can't ...
1
vote
0
answers
60
views
Sequelize limit insert or create in 100 rows
I am use Sequelize with Postgree in a Serveless project. I just try to get an array of +600 objects from API and I need to send to DB. I use a map() for that array and I use sequelize upsert() or ...
0
votes
0
answers
41
views
Many to many relationship Sequelize v7
I´m trying to establish a follow list to from user to user:
class Follower extends Model<InferAttributes<Follower>, InferCreationAttributes<Follower>> {
@Attribute(DataTypes.UUID)
...
0
votes
2
answers
52
views
sequelize relationships Cannot read properties of undefined (reading 'hasMany')
I'm trying to integrate sequelize with the db conection to postgres and i am getting an error where relationships are built.
i don't know if i'm missing something at this point
index.js
'use strict';
...
0
votes
0
answers
42
views
Sequelize bulkCreate fails with duplicate entry error despite non-duplicate data and updated unique constraints
i am trying to migrate the dataset in mysql database being the role_id and module_id same mysql is refusing to store saying
sqlMessage: "Duplicate entry '3-1' for key 'role_module_bridge....
0
votes
0
answers
46
views
Sequelize bulkCreate updateOnDuplicate: Cannot read properties of undefined (reading 'map')
I want to update multiple records ( more than 100 ) and for this I am trying to use bulkCreate method of sequelize with following parameters:
const updatedUsers = await User.bulkCreate(allUserInfo, {
...
1
vote
0
answers
29
views
Cannot generate model using sequelize-cli enum with defaultValue
My sequelize-cli is
npx sequelize-cli model:generate --name Profile --attributes username:string,imageUrl:string,fullname:string,dateOfBirth:date,UserId:UUID,role:enum:'{staff,admin}':defaultValue:...
0
votes
0
answers
56
views
How to infer model type from plain schema in Sequelize?
In Sequelize, I've the following schema:
const User = sequelize.define('User', {
name: DataTypes.STRING,
email: DataTypes.STRING,
})
But in TS, User ends up being typed as ModelCtor<Model<...
0
votes
0
answers
27
views
How do I get the typed raw attributes of a Sequelize model that's a property of another model that is optional?
I have a Sequelize model that has a property that is also a model. In this case, Category has a property ParentCategory that is an optional model of Category. When I get the "non model" ...
0
votes
0
answers
14
views
exclude sequelize lib when using vite to build application
I have a frontend web project A with dependencies B, the dependencies B using sequelize that only work in node with server side. So I tried to exlclude sequelize https://sequelize.org/ in project A ...
1
vote
1
answer
194
views
How to properly include SQLite3 with an Electron, Electron Forge, Sequelizer set-up in production?
I've been trying to set-up a working Electron application using Electron Forge with Sqlite3 and Sequelize. This has worked great up until where I need to actually build and package, and distribute the ...
-3
votes
1
answer
100
views
Getting False-positive SQL Injection warnings on parameterized Sequelize queries in Snyk Code
I maintain a Node.js (v14.x) + Express + Sequelize (v6.x) application and use Snyk Code to catch security issues in our CI pipeline. We rely heavily on Sequelize’s parameter binding (:param) to ...
1
vote
1
answer
79
views
How to add order clause in sequelize-cursor-pagination
I'm using the sequelize-cursor-pagination package to implement pagination in my Node-Postgres application. I need to order my results based on a field from an included (associated) model, but the ...
-1
votes
1
answer
66
views
How to exclude unnecessary database dialects while bundling with esbuild/rollup in Vite with Sequelize?
I have been scratching my head for a while now trying to figure out how to exclude unnecessary database dialect adapters. For context, I am building an app with Vite. Its using ElectronJs and ...
0
votes
1
answer
47
views
Sequelize Associations Miss Some Data
I'm making a query to Articles table to get the article data with publisher, tags, images and categories. The relation between publisher and article is M:1, between tags and articles N:M, between ...
0
votes
1
answer
36
views
Dynamic includes in node API with Sequelize
I am creating a node API connecting to a mySql db using Sequelize. I want users of the API to be able to specify which models to include in the results of a query. For example I have a model like this:...
0
votes
0
answers
43
views
Associating two models twice
In sequelize documentation, it is stated in association alias section
Aliases are especially useful when you need to define two different associations between the same models. For example, if we have ...
1
vote
0
answers
71
views
Error creating property: no pg_hba.conf entry for host "172.31.8.1", user "postgres", database NAME, no encryption
I'm having issues running RDS sequelize queries. I'm using EC2 Node.js
original: error: no pg_hba.conf entry for host "172.31.8.1", user "postgres", database NAME, no encryption
5|...
1
vote
0
answers
39
views
Is possible to use VS Code Intellisense with Sequelize + JS
I'm learning sequelize + other stuff and I'm using sequelize-cli to initialize the sequelize and generate the models. When I try to use the model in other file it doesn't suggest anything related to ...
1
vote
1
answer
109
views
Migrating sequelize model to typescript and getting the error "error relation does not exist"
I'm in the process of migrating a Javascript project to Typescript. One of the steps is to migrate the sequelize models. I'm following the instructions located at: https://sequelize.org/docs/v6/other-...
0
votes
0
answers
28
views
graphql-sequelize and useMaster
I would like to know how to correctly use useMaster with graphql-sequelize.
I'm trying to force the query to go to the master database using this code:
before: (findOptions) => {
const ...
1
vote
1
answer
41
views
Sequelize magic method not adding foreign key
Sequelize's createXXXXX method doesn't seem to be adding the necessary foreign key.
This running the following code for these two models gives me a "notNull Violation: Seat.office_id cannot be ...
0
votes
1
answer
54
views
Getting just the associated id(s) of a record
I don't want to eagerly load all the associated data, it won't be used. But, I might want to know that related records exist, for example to link to related records.
So I'm trying to set up an ...
0
votes
0
answers
36
views
I'm new to Node.js and sequelized and I'm having a problem with related tables
Here is the full code:
const StockTypes = require('./stock_types');
module.exports = (sequelize, DataTypes) => {
const Stock = sequelize.define('Stock', {
name: {
type: DataTypes....
0
votes
0
answers
33
views
Postgres Sequelize not using provided name
Trying to establish a connection to my local PostgreSQL database via Sequelize. I have no trouble accessing it with pgAdmin, using postgres as the user and no password.
I am passing this into the ...
2
votes
1
answer
213
views
PostgreSQL 63-Character Limit Issue in Sequelize with Multiple Includes
I’m currently working on a project where we are using PostgreSQL with Sequelize to perform complex queries involving multiple nested include relationships. However, we’ve encountered an issue related ...
0
votes
0
answers
34
views
Sequelize sync still running the alter queries even when alter is false
await sequelize.sync({ alter: false, force: false });
My expectation and also as per the sequelize documentation this will only create the new tables if not present, it will not run any alter query.
...
1
vote
1
answer
49
views
NodeJS Sequelize Raw Query Not Returning All 2 Rows
I have 2 rows in the database table moneys.
Using Sequelize, I want to select all rows from the table.
The following raw query in DBeaver MySQL client returns all the results. So, that works as it ...
0
votes
0
answers
112
views
How to properly configure @adminjs/upload to store image files and hide the text input for the file path?
Product Model
import { DataTypes } from "sequelize";
import sequelize from "../util/database.js";
const Product = sequelize.define("product", {
id: {
type: ...
0
votes
0
answers
53
views
How to set all field names to lowercase by default [duplicate]
When querying Postgres, field names are case-insensitive:
select id from contact;
and
select Id from contact;
will both work.
But, when using sequelize (v6), the attribute in my model definition must ...
0
votes
1
answer
73
views
Using import vs require with Node and Sequelize
I'm using type module/import syntax for the rest of my project, but the Sequelize CLI generates files with require syntax. How should I handle this? I'm already having trouble with not being able to ...
0
votes
1
answer
220
views
Sequelize.js with sequelize-typescript started emitting warnings
I've been using Sequelize (6.37.X) on a small side-project for a while. Just a day or so ago, I started having failures in my unit tests, and I'm seeing a lot of this warning on the console:
(...
0
votes
0
answers
60
views
SequelizeEagerLoadingError: ModelA is not associated to ModelB (intermittent in multi-schema setup)
I'm using Sequelize v6.37.5 with PostgreSQL in a multi-tenant architecture, where each tenant has its own schema. Models are defined once globally, and we use .schema(schemaName) to access tenant-...
0
votes
0
answers
47
views
Sequelize V7 BelongsToMany Association Adder return is not a function
I make an association BelongsToMany, Chapter as many Chapter with sequelize V7
But when I create a Association Adder I have an error:
TypeError: chapter.addChapter is not a function
This is my model ...
1
vote
1
answer
91
views
mysql2 ETIMEDOUT error with rate-limiter-flexible, but Sequelize connects fine
I'm working on a Node.js backend project and have run into a strange issue involving MySQL connections. Here's the situation:
I am using a MySQL database hosted on Digital Ocean (Managed MySQL ...
0
votes
0
answers
28
views
Typescript Sequelize v6 nested create with associations
Relevant packages:
"sequelize": "^6.37.6"
"sequelize-typescript": "^2.1.6"
I am using sequelize and typescript in a project. I am receiving an error when ...
0
votes
1
answer
69
views
GraphQL not accepting login credentials
So I'm trying to create a user for my task management app, I'm using Express.js, Sequelize ORM for PostGres and Apollo/Server for graphql.
Creating a user works fine, but when I try to login using ...
0
votes
0
answers
24
views
using the sequelize findOrCreate with axios
I am trying to have the sequelize function findOrCreate in combo with axios.
I have a couple of routes setup like:
router.get("/byId/:id", async (req, res) => {
const id = req.params....
0
votes
0
answers
39
views
Sequelize findOrCreate() creates duplicate Terms and Listings
Consider the following models and the following post method:
router.post("/", async (req, res, next) => {
const {
address: addressData,
building: buildingData,
items: ...
0
votes
0
answers
40
views
Data Leakage issue when caching multiple sequelize instance
When I cache multiple Sequelize instances while sharing the same models (entities), the last cached instance in memory overrides the Sequelize instance of the models from the previous cache.
for ...
0
votes
0
answers
13
views
Sequelize CLI access from one model to another
I use sequelize-cli migration scripts to create models
I have created models 'user' and 'user-role'
I want to access to model user_role from the file user
This how my directory structure looks like:
[...
1
vote
1
answer
52
views
Netlify app can't login to Express app only on mobile
I have a Vue 3 app hosted on Netlify, and the backend is hosted on Heroku. The login is a simple /login endpoint made with Express and Sequelize. It works well on desktop, but when I try to log in on ...
0
votes
0
answers
34
views
Sequelize Snowflake (v7 alpha) TypeError when syncing a model
I'm getting a Type error when trying to sync a model with @sequelize/snowflake ( "@sequelize/core": "^7.0.0-alpha.42", "@sequelize/snowflake": "^7.0.0-alpha.45")...
0
votes
0
answers
34
views
sequelize-typescript validation
When adding a sequelize-typescript's decorator to the model field, which should check that the field is not empty, validation does not work and allows you to create a record without passing this field....
0
votes
2
answers
42
views
Function count associated entries with Sequelize return 1 instead 0
I try count foreign table rows with Sequelize
this.publicationModel.findAll({
attributes: {
include: [
[Sequelize.cast(Sequelize.fn('COUNT', 'comments.id'), 'int' ), '...
0
votes
1
answer
80
views
How to push data in an array of JSONB column using sequelize
I have a table named Expenses and the table has a column named expenseEditHistory. The column is of JSONB type. I am using sequelize to manage the database (postgres).
Structure for expenseEditHistory ...
0
votes
2
answers
172
views
SequelizeModule — autoLoadModels / [Nest] ERROR SequelizeModule Unable to connect to the database. Retrying
I'm learning Nest.js, I'm trying to connect via SequelizeModule to my local postgres database, but I keep getting this error
Error when starting start:dev
[20:41:14] Starting compilation in watch mode....
0
votes
1
answer
59
views
Sequelize Model Not Creating Table in MySQL Database (TypeError: Cannot read properties of undefined (reading 'define'))
I’m working on a Node.js project using Sequelize with MySQL. The database connection is established successfully, and sequelize.sync({ alter: true }) runs without errors, but my users table is not ...