Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

server error message [ERR_INVALID_ARG_TYPE]:

I'm getting a error message on my server saying: TypeError [ERR_INVALID_ARG_TYPE]: The "key" argument must be of type string or an instance of ArrayBuffer, Buffer, TypedArray, DataView, KeyObject, or CryptoKey.

<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script>
const express = require('express');
 const bodyParser = require('body-parser');
 const bcrypt = require('bcrypt-nodejs');
 const cors = require('cors');
 const knex = require('knex');
const register = require('./controllers/register');
const signin = require('./controllers/signin');
const profile = require('./controllers/profile');
const image = require('./controllers/image');

 const db = knex({
    client: 'pg',
    connection: {
      host : '127.0.0.1',
      user : 'postgres',
      password : '',
      database : 'smart-brain'
    }
  });

 const app = express();

 app.use(cors());
 app.use(bodyParser.json());
 

app.get('/', (req, res)=> {res.send(database.users) })

 app.post('/signin',  signin.handleSignin(db,bcrypt))

 app.post('/register', (req, res) => {register.handleRegister(req, res, db, bcrypt) })

 app.get('/profile/:id', (req, res)=> {profile.handleProfileGet(req, res, db)})

 app.put('/image', (req, res) => {image.handleImage(req, res, db)})

app.listen(3000, ()=> {
  console.log('app is running on port 3000');
})
like image 786
CENTRAL RECORDS Avatar asked Oct 30 '25 09:10

CENTRAL RECORDS


1 Answers

Sounds like a database credentials issue. It looks like you have "" for a password and you're using postgres for you database. You might want to recheck that your superuser(postgres) does not have a password or reset it.

You might also check to see if you have coded any conditional process.env USER and PASSWORD variables in your app that. If you have then you will have to assign those variables in your .env file.

like image 143
Isaac Pak Avatar answered Nov 02 '25 00:11

Isaac Pak



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!