Ini konsol:

P:\.Projektek\lireddit-server>yarn dev
    yarn run v1.22.10
    $ nodemon dist/index.js
    [nodemon] 2.0.7
    [nodemon] to restart at any time, enter `rs`
    [nodemon] watching path(s): *.*
    [nodemon] watching extensions: js,mjs,json
    [nodemon] starting `node dist/index.js`
    [discovery] ORM entity discovery started, using ReflectMetadataProvider
    [discovery] - processing entity Post
    [discovery] - entity discovery finished, found 1 entities, took 29 ms
    internal/crypto/keys.js:322
        throw new ERR_INVALID_ARG_TYPE(
        ^
    
    TypeError [ERR_INVALID_ARG_TYPE]: The "key" argument must be of type string or an instance of Buffer, TypedArray, DataView, or KeyObject. Received null
        at prepareSecretKey (internal/crypto/keys.js:322:11)
        at new Hmac (internal/crypto/hash.js:111:9)
        at Object.createHmac (crypto.js:147:10)
        at createHMAC (P:\.Projektek\lireddit-server\node_modules\pg\lib\sasl.js:133:17)
        at Hi (P:\.Projektek\lireddit-server\node_modules\pg\lib\sasl.js:137:13)
        at Object.continueSession (P:\.Projektek\lireddit-server\node_modules\pg\lib\sasl.js:32:24)
        at Client._handleAuthSASLContinue (P:\.Projektek\lireddit-server\node_modules\pg\lib\client.js:257:10)       
        at Connection.emit (events.js:315:20)
        at Connection.EventEmitter.emit (domain.js:467:12)
        at P:\.Projektek\lireddit-server\node_modules\pg\lib\connection.js:115:12 {
      code: 'ERR_INVALID_ARG_TYPE'
    }
    [nodemon] app crashed - waiting for file changes before starting...

Saya tidak tahu harus berbuat apa, tolong bantu: c

BTW IM DOIN Ben Awad's fullstack tutorial panjang 14 jam server postgresql saya terlihat baik-baik saja, idk apa yang bisa menjadi masalah, tetapi jika Anda tidak tahu apa-apa

0
Péter Lanszki 5 April 2021, 00:07

1 menjawab

Jawaban Terbaik

Anda memiliki contoh Postgres yang dilindungi kata sandi tetapi Anda tidak menyediakan kata sandi.

import { Options } from '@mikro-orm/core';

const config: Options = {
  migrations: {
    path: path.join(__dirname, "./migrations"), // path to the folder with migrations
    pattern: /^[\w-]+\d+\.[tj]s$/, // regex pattern for the migration files       
  },
  entities: [Post],
  dbName : 'lireddit',
  type: 'postgresql',
  password: "s3xy",
  debug: !__prod__,
};

export default config;

Sumber: https://github.com/mikroorm/ Mikro-ORM / Masalah / 866 # Issuecomment-720791720

0
Martin Adámek 4 April 2021, 21:25