This repository was archived by the owner on Jun 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 157
This repository was archived by the owner on Jun 10, 2022. It is now read-only.
Error at Query.run, might be located at auth.js #11
Copy link
Copy link
Open
Description
I am currently trying to redo your project on my own without heroku, hosted on localhost. Whenever I use postman to test the endpoints, I keep getting this error on my console:
Server started at http://localhost:5000
Error
at Query.run (C:\Users\donal\videos\Web-Developement\videojs\vc-be\server\node_modules\sequelize\lib\dialects\postgres\query.js:50:25)
at C:\Users\donal\videos\Web-Developement\videojs\vc-be\server\node_modules\sequelize\lib\sequelize.js:313:28
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async PostgresQueryInterface.insert (C:\Users\donal\videos\Web-Developement\videojs\vc-be\server\node_modules\sequelize\lib\dialects\abstract\query-interface.js:297:21)
at async model.save (C:\Users\donal\videos\Web-Developement\videojs\vc-be\server\node_modules\sequelize\lib\model.js:2424:35)
at async Function.create (C:\Users\donal\videos\Web-Developement\videojs\vc-be\server\node_modules\sequelize\lib\model.js:1336:12)
at async C:\Users\donal\videos\Web-Developement\videojs\vc-be\server\controllers\auth.js:12:18
This is my current code for auth.js:
const { Op } = require("sequelize");
const { User } = require('../sequelize');
const bcrypt = require("bcryptjs");
const jwt = require("jsonwebtoken");
const asyncHandler = require('../middlewares/asyncHandler');
// exports.signup = asyncHandler(async (req, res, next) => {
// console.log('this function works');
// });
exports.signup = asyncHandler(async (req, res, next) => {
const user = await User.create(req.body);
await user.save();
res.status(200).json({ success: true, data: token });
console.log('this function works');
});
Did you ever experience something like this before?
Metadata
Metadata
Assignees
Labels
No labels