All Questions
Tagged with node.js sequelize.js
8,516 questions
0
votes
0
answers
36
views
How to solve the microservices with foreign key constraint? [closed]
I am working with micro services: product service, order service, auth service and so forth. Each service has a database table, for database I am using PostgreSQL with sequelize.
Now the problem I am ...
0
votes
2
answers
59
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
50
views
Sync Sequelize model with database
I am trying to sync a Sequelize model with my database, but I can't get over this error.
Using Sequelize as my ORM, database is Oracle express:21.3.0-xe
This is the error:
Executing (default): ...
0
votes
0
answers
25
views
Issues with many to many relation with sequelize in my controller
This is my first time here, and I hope I can provide you with all the information you need.
I am using Sequelize for a project I am working on after completing my web development training. I have many ...
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 ...
0
votes
0
answers
38
views
Pagination on high amount of rows using Sequelize and MySQL
I am using Sequelize with Node for my backend.
One of my tables is probably going to grow a lot in the coming weeks (at this moment, the table is around 1-2M rows).
I added 30M lines and added the ...
0
votes
0
answers
21
views
Sequlize query lifecycle watch
I am trying to debug the full SQL lifecycle.
In my NestJS project, I am using Sequelize.
I have added two hooks:
sequelize.addHook('beforeFind', (options) => {
const transaction = apm....
0
votes
0
answers
30
views
How to move ORDER BY into Subquery AFTER LIMIT without using subQuery: false? [duplicate]
How do I move ORDER BY into a subquery right after LIMIT without using subQuery: false?
This is my Sequelize query:
return await this._conversation.findAll({
// subQuery: false,
where: params....
0
votes
0
answers
31
views
Sequelize findAll() - INNER JOIN table B but return JSON result as multiple table A rows (duplicates) based on table B rows? [duplicate]
I want Sequelize to return multiple table A rows (duplicates) based on table B matches in the return JSON result with:
await this._conversation.findAll({
include: [
{
...
0
votes
0
answers
26
views
Sequelize Associations Error: "Product is not associated to CartItem" while eager loading relationships
I'm working on a Node.js project using Sequelize, and I'm encountering an error when trying to fetch associated data with eager loading. Here's the error:
Error fetching cart items: EagerLoadingError [...
0
votes
0
answers
24
views
Resolving ER_BAD_FIELD_ERROR in Sequelize: Handling Bulk Create and Update in Node.js
I am working on a task that involves creating a new table named newtable in the database, adding the DepartmentName field from new_dev_db.departmentmaster to it, and updating the isServiceable field ...
2
votes
1
answer
33
views
How to make multiple HasMany on the same model / foreign key in Sequelize?
Having some trouble using Sequelize V7 with the HasMany
For explaining my problem, I actually have an Item model and TextContent model.
The first one represent item with nameID and descriptionID i ...
0
votes
2
answers
32
views
How to filter associated models connected using through table and keeping all associated model
I want to filter conversations based on a user Id and get all users in that conversation. Users and conversations are joined using a through model
This is my approach
user.entity.ts
@BelongsToMany(...
0
votes
0
answers
23
views
JSON changes in the sequelize database are not applied
I'm building my discord bot on the Discord library.js and I need to make a resource system. To do this, I decided to use the sqlite3 database in conjunction with sequelize. I use json strings to store ...
0
votes
0
answers
21
views
How to Return a JSON Error Response in Sequelize with Sentry Integrated?
I'm working on an Express application using Sequelize for the database, and Sentry for error tracking. However, I'm struggling to return a JSON response with error details when an exception occurs in ...
1
vote
1
answer
48
views
Sequelize update query resulting in error
I'm running into an issue where querying my database for an update is returning an error in my express app using sequelize. I have the following code in my controller:
I'm seeing the following error ...
0
votes
0
answers
19
views
Nested dependencies in mono-repo not found even though they're there
I have a monorepo that uses several local packages via links in package.json
The setup works fine except for one issue, Sequelize. Sequelize has problems if you have multiple packages including it
as ...
0
votes
0
answers
13
views
Issue connecting Codebuild to RDS (Sequelize command)
I'm getting the following error in Codebuild when trying to connect to local RDS instance.
Tried adding inbound rules to RDS for all Codebuild IPs listed in AWS from the documentation below and no ...
0
votes
0
answers
27
views
Intermittent Connection Issues with Sequelize Migrations in Docker Compose Setup [duplicate]
I am using Docker Compose to set up my application, which consists of three services: a MySQL database, a backend API, and a Vue.js frontend. My backend uses Sequelize for database migrations.
However,...
0
votes
1
answer
40
views
Sequelize create() not working for inserting an order, but manual SQL query works
I am trying to create an order using Sequelize in my Node.js app, but I'm encountering issues with both the Order.create() method and a manual INSERT INTO query.
Here is the code I'm using to create ...
0
votes
1
answer
23
views
Can sequelize have self ref column to support a child parent relationship within the same table?
does seauelize support self reference tables?
For example, if I have a table called product, and logically, it has child / parent relationships with its self, so I defined a parent_id column that has ...
0
votes
0
answers
20
views
Sequelize ORM: Dynamically set database schema for sequelizeInstance (or repositories) at runtime?
For our SaaS API we use schema-based multitenancy, which means every customer (~tenant) has its own separate schema within the same (MySQL) database, without interfering with other customers. Each ...
0
votes
0
answers
21
views
Problem uploading image from express to s3
I want to upload an image to s3 but cant, eventhough a similar api like that can work normally.
exports.createPost = async (req, res) => {
const { user_id, title, caption } = req.body;// ...
0
votes
0
answers
25
views
Sequelize Adding Association Causes Always Alter
I am trying to add multiple associations to my project. Although, other tables do not giving this error or misusage effect these associations makes the project always alter.
db.option.hasMany(db....
0
votes
0
answers
21
views
Sequalize associating one model on an RDS database and an Aurora database
I tried to associate a model with 2 different databases that have this same table, one in an aurora db and another in a RDS db using sequalize. They have a different schema name but the same table ...
0
votes
0
answers
24
views
Sequelizer belongsToMany relations
I am trying to establish a belongsToMany relationship between two models, User and Company.
I think I have done everything right, but the funny thing is that the api shows me the results relationships ...
1
vote
0
answers
75
views
Please install sqlite3 package manually
I get an npm error from the sequelize module when running the project via node:
"start": "node build/scripts/main.js"
webpack-internal:///../../node_modules/sequelize/lib/dialects/...
0
votes
0
answers
28
views
Is posible install old version of adminjs
I'm searching an admin template for an application based on NodeJs+Express+Sequelize.
I find Adminjs that seem like very usefull for my purpose, but i read in documentation that is deprecate Js syntax ...
1
vote
0
answers
32
views
Sequelize associations with multi-tenant (schemas) solution
I'm rather new to backend development, so bear with me.
I have a 'partners' table in the 'public' schema and each partner has their own schema like 'partner_1', 'partner_2', etc...
Their schemas ...
1
vote
0
answers
20
views
SequelizeAssociationError: Conflict in defining HasMany and BelongsTo relationships between User and Friends models
I am trying to define a HasMany and BelongsTo relationship between my User and Friends models in Sequelize. However, I am encountering the following error when I start my server:
AssociationError [...
0
votes
1
answer
42
views
Sequelize Error: Restaurant.belongsTo called with something that's not a subclass of Sequelize.Model when importing Order model
I recently added a new model called Order to my project and successfully migrated it. However, the system does not seem to recognize it as a model. When I import it into my index.js file, it doesn't ...
-1
votes
1
answer
59
views
Getting ERR_MODULE_NOT_FOUND in my Heroku App but working fine in localhost
Thanks for being here.
My stack
Postgres
Node 20.17.0
Express
Sequelize ORM
Javascript
When started happening?
This started happening after migrating my app from the 'require' to 'import' syntax. I ...
0
votes
1
answer
46
views
How to Query Bookmarked Posts Instead of Authored Posts in Sequelize
I’m new to Sequelize, so I apologize if my question seems basic. I have defined two models in my Sequelize setup: Post and User. I’m trying to query both the posts a user has authored and the posts ...
0
votes
0
answers
41
views
Problem building query sequelize-typescript
I am currently facing an issue when creating a query with sequelize-typescript. The problem arises when trying to fetch records from a many-to-many relationship. Here is the SQL query I am trying to ...
0
votes
1
answer
32
views
In nodejs (sequelize), Add new key or column in MySql via migration
In nodejs (sequelize) ,Add new key or column in MySql via migration but it is not defined in the model so how it update automatically in the model
I have make new migration on adding new column and ...
0
votes
0
answers
23
views
node js Sequelize one to many single create[Solved]
Is there anything wrong with the way the code is wrote? Because using one-tone I can insert the data normally, but when use one to many, the data is just ignored.
The idea is:
Contact Model can have ...
0
votes
0
answers
23
views
Sequellize app.post show Error saving QR history: TypeError: Cannot read properties of undefined (reading 'apply')
I would like to make a post request, to save my built QR Code that I test my route to Postman. Ok,it works my QR code is saved into my database but it show this error message
Error creating QR history:...
0
votes
0
answers
28
views
Squelize Sort By Included Model
I'm struggling to sort cases by the patients first name. I've tried nearly every possibility I feel like I could and still nothing. For some reason, it's changing the column name and then it can't ...
0
votes
1
answer
25
views
Sequelize Alias mismatch
## Product Model ##
module.exports = (sequelize, DataTypes) => {
const Product = sequelize.define('Product', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement:...
1
vote
1
answer
106
views
Sequelize transactions are very slow
I'm using sequelize with node to make a simple update endpoint that will make a couple of queries:
const update = async (req: any, res: any, next: any) => {
const t = await db.sequelize....
0
votes
1
answer
124
views
Unable to order based on joined table with Many to Many relationship
I'm trying to order a set of paged results based on the existence of many to many relationship. I can write a query by hand that does this, but I'm trying to figure out how to do this the sequelize ...
0
votes
1
answer
40
views
Sequelize: User is not associated to Commentaire
I am working with two Sequelize models: User and Comment. Each Comment belongs to a User, and a User can write multiple comments. My goal is to include all comments associated with each user in my ...
0
votes
1
answer
36
views
Is Sequelize Truncating the JSON Response with Nested Relations?
If you look at the productPGs and variantPGs relationships you notice the keys are cutoff or truncated, why is that happening? This only happens when I use include: { all: true, nested: true } in the ...
0
votes
0
answers
64
views
Sequelize sync SQL Server database
I have a question regarding the sync method in Sequelize with SQL Server. To summarize the problem: I have a model with a unique column, and when the table doesn't exist or the database is empty, the ...
1
vote
0
answers
98
views
Sequelize and SQL Server
I am building a React app with Node.js and Sequelize with SQL Server. I am running into the below error. I am using the v7 alpha version of Sequelize.
My model is below:
import { Sequelize, DataTypes, ...
0
votes
1
answer
32
views
Sequelize with typescript defining associations
For the past three days, I've been trying to integrate Sequelize M:N (many-to-many) associations with TypeScript.
The issue arises when I follow the official Sequelize documentation, which suggests ...
0
votes
0
answers
31
views
Sequelize Error: "Dialect needs to be explicitly supplied as of v4.0.0" when using config.ts with dotenv-flow
I'm working on a Node.js project with TypeScript, Sequelize, and PostgreSQL. I encountered the following error when running my application:
ERROR: Dialect needs to be explicitly supplied as of v4.0.0
...
0
votes
0
answers
34
views
Sequelize many-to-many relation query search very slow
I use nodejs, mysql and sequelize. I have 3 model: Post , Tags and PostToTags. I add many-to-many relation between Post and Tags. Post model have title, content attributes. Tags model have title and ...
1
vote
0
answers
25
views
how arrange every attributes in a parent level attributes array
const allItems = await findAndPaginate(CartItems, req.query, {
attributes: [
["cart_items_id", "cartId"],
["cart_item_mrp", &...
0
votes
1
answer
25
views
I want to Find data in Sequelize that createdAt and UpdateAt same Consider only date Not date time
const StudentAssessmentTransaction = sequelize.define(
"studentAssessmentTransaction",
{
id: {
type: DataTypes.INTEGER,
allowNull: false,
...