Skip to main content

All Questions

Tagged with
0 votes
2 answers
1k views

Nodejs - unable to load environment variable in mysql2

I am using the mysql2 package for connecting node with MySQL and I am using a .env file to store my username and password. But when I use it in my config for connecting MySql it doesn't load. It ...
0 votes
1 answer
32 views

ORM Sequelize model.upsert() is not a function

Version sequelize 6.37.3 I try to upsert() myModel but the mehtod returns: TypeError: model.upsert is not a function my_model.controller.ts ... class MyModelController { private model: any; ....
22 votes
2 answers
60k views

Finding sum and grouping in sequelize

I have a donations table as follows. Donations Table | id| amount | member_id | |---|--------|-----------| | 0 | 500 | 01| | 1 | 1000 | 02| | 2 | 2000 | 01| How to ...
5 votes
3 answers
6k views

Error: Incorrect arguments to mysqld_stmt_execute

I am working on a nodeJs project and using a npm package mysql2 for mysql database. My MySql Configuration:- let mysql = MYSQL.createConnection({ host: `${config.mysql.host}`, user: `${config....
-1 votes
2 answers
84 views

MySQL insert query successful but not inserting into database table

I am working on a React/MySQL registration page. The insert query runs, but is not inserting into the database table. I am not sure why. In the backend folder, I have my server.js file: const ...
0 votes
0 answers
17 views

While running server.js in kubernetes pods getting errors connect ETIMEDOUT

Error connecting to the database server: Error: connect ETIMEDOUT at Connection._handleTimeoutError (/usr/src/app/node_modules/mysql2/lib/connection.js:205:17) at listOnTimeout (internal/timers.js:557:...
-1 votes
0 answers
18 views

GET http://127.0.0.1:3001/search/3 404 (Not Found) error for retreiveing a record from a database

I am trying to create a web app to retrieve records from a mysql database but it seems i keep getting the 404 not found error. I am suing node.js for server side, and it seems that my endpoints are ...
0 votes
1 answer
32 views

How to get Sequelize to recognize by primary key with MySQL database data set and fix bulkCreate() issue?

So I have a database where I am trying to establish a one-to-many relationship between Supplier and TreeSeed, whereby one Supplier can sell many TreeSeed. I have looked at the sequelize documentation ...
-1 votes
0 answers
18 views

How to fix 'ER_FK_CANNOT_DROP_PARENT' error, 'ER_NO_SUCH_TABLE', 'ER_BAD_FIELD_ERROR' in Sequelize for MySQL? [duplicate]

When I run my server.js file I get the error mentioned in title.Also I get null violation errors when trying to insert into the TreeSeeds table. There is a foreign key called seedcompany_id in the ...
0 votes
1 answer
54 views

How to get Sequelize to recognize my custom foreign key and primary keys in a one-to-many relationship in MySQL during bulkcreate insert?

I am building a plant/arboretum style application in JavaScript. I am trying to create a one-to-many relationship between Supplier model and TreeSeed model. Meaning that one supplier can sell multiple ...
0 votes
2 answers
15k views

TypeError: Cannot read property 'query' of undefined?

I am trying to deploy my node app with Docker.Here is my node app: var express = require('express'); var path = require('path'); var mysql = require('mysql'); var app = express(); var bodyparser = ...
0 votes
2 answers
11k views

sending data from html form to mysql database using node js

I'm making an app and I'd like to have a register page. Here is the html form : <form method="post" action="/register"> <p>Nom <input type='text' id="nom"></p> <p>...
0 votes
3 answers
2k views

sequelize error: missing index for constraint

20181005120552-create-order-detail.js 'use strict'; module.exports = { up: (queryInterface, Sequelize) => { return queryInterface.createTable('OrderDetails', { orderDetailId: { ...
46 votes
5 answers
71k views

Sequelize select * where attribute is NOT x

looking at the docs you can use model.findAll({where: {attribute: x}}). However, I want to select all attributes that are simply NOT x. I was looking into a regular expression here but that ...
48 votes
31 answers
172k views

Error: secretOrPrivateKey must have a value

I am using jwt to create token, but when i login via postman I get the error "Error: secretOrPrivateKey must have a value" from my console. I have attached my login code. Please anyone who can help me ...

15 30 50 per page
1
2 3 4 5
796