sequelize / sequelize-auto

Automatically generate bare sequelize models from your database.
2.9k stars 527 forks source link

ConnectionError [SequelizeConnectionError]: no pg_hba.conf entry for host "...", user "...", database "...", no encryptio #619

Open itsManeka opened 2 years ago

itsManeka commented 2 years ago

when i run the command line below i am getting the following error:

npx sequelize-auto -o "./src/database/models" -d [...] -h [...].compute-1.amazonaws.com -u [...] -p [...] -x [...] -e postgres -c "./src/database/config/database.json" -t t1 t2 t3

I changed the data to ... or [...] for security. The database is hosted on heroku

{
  development: {
    username: '...',
    password: '...',
    database: '...',
    host: '...',
    port: ...,
    dialect: 'postgress',
    protocol: 'postgress'
  },
  test: {
    username: '...',
    password: '...',
    database: '...',
    host: '...',
    port: ...,
    dialect: 'postgress',
    protocol: 'postgress'
  },
  production: {
    username: '...',
    password: '...',
    database: '...',
    host: '...',
    port: ...,
    dialect: 'postgress',
    protocol: 'postgress'
  },
  directory: './src/database/models',
  additional: {},
  dialect: 'postgres',
  port: ...,
  host: '...',
  database: '...',
  storage: '...',
  tables: [ 'acaos', 'usuarios', 'produtos' ],
  skipTables: null,
  skipFields: null,
  pkSuffixes: null,
  schema: undefined,
  lang: 'es5',
  caseModel: 'o',
  caseFile: 'o',
  caseProp: 'o',
  noAlias: false,
  noInitModels: false,
  noWrite: false,
  views: false,
  singularize: false,
  username: 'fsoqmaggjlgktv',
  useDefine: false,
  indentation: 2,
  noIndexes: false
}
ConnectionError [SequelizeConnectionError]: no pg_hba.conf entry for host "...", user "...", database "...", no encryption
    at Client._connectionCallback (C:\fontes\0180947\b\Dev\VsCode\AmzBot\node_modules\sequelize\lib\dialects\postgres\connection-manager.js:142:24)
    at Client._handleErrorWhileConnecting (C:\fontes\0180947\b\Dev\VsCode\AmzBot\node_modules\pg\lib\client.js:305:19)
    at Client._handleErrorMessage (C:\fontes\0180947\b\Dev\VsCode\AmzBot\node_modules\pg\lib\client.js:325:19)
    at Connection.emit (events.js:315:20)
    at C:\fontes\0180947\b\Dev\VsCode\AmzBot\node_modules\pg\lib\connection.js:114:12
    at Parser.parse (C:\fontes\0180947\b\Dev\VsCode\AmzBot\node_modules\pg-protocol\dist\parser.js:40:17)
    at Socket.<anonymous> (C:\fontes\0180947\b\Dev\VsCode\AmzBot\node_modules\pg-protocol\dist\index.js:11:42)
    at Socket.emit (events.js:315:20)
    at addChunk (internal/streams/readable.js:309:12)
    at readableAddChunk (internal/streams/readable.js:284:9) {
  parent: error: no pg_hba.conf entry for host "147.161.129.100", user "fsoqmaggjlgktv", database "df2mglpesp0tn9", no encryption
      at Parser.parseErrorMessage (C:\fontes\0180947\b\Dev\VsCode\AmzBot\node_modules\pg-protocol\dist\parser.js:287:98)
      at Parser.handlePacket (C:\fontes\0180947\b\Dev\VsCode\AmzBot\node_modules\pg-protocol\dist\parser.js:126:29)
      at Parser.parse (C:\fontes\0180947\b\Dev\VsCode\AmzBot\node_modules\pg-protocol\dist\parser.js:39:38)
      at Socket.<anonymous> (C:\fontes\0180947\b\Dev\VsCode\AmzBot\node_modules\pg-protocol\dist\index.js:11:42)
      at Socket.emit (events.js:315:20)
      at addChunk (internal/streams/readable.js:309:12)
      at readableAddChunk (internal/streams/readable.js:284:9)
      at Socket.Readable.push (internal/streams/readable.js:223:10)
      at TCP.onStreamRead (internal/stream_base_commons.js:188:23) {
    length: 175,
    severity: 'FATAL',
    code: '28000',
    detail: undefined,
    hint: undefined,
    position: undefined,
    internalPosition: undefined,
    internalQuery: undefined,
    where: undefined,
    schema: undefined,
    table: undefined,
    column: undefined,
    dataType: undefined,
    constraint: undefined,
    file: 'auth.c',
    line: '545',
    routine: 'ClientAuthentication'
  },
  original: error: no pg_hba.conf entry for host "...", user "...", database "...", no encryption
      at Parser.parseErrorMessage (C:\fontes\0180947\b\Dev\VsCode\AmzBot\node_modules\pg-protocol\dist\parser.js:287:98)
      at Parser.handlePacket (C:\fontes\0180947\b\Dev\VsCode\AmzBot\node_modules\pg-protocol\dist\parser.js:126:29)
      at Parser.parse (C:\fontes\0180947\b\Dev\VsCode\AmzBot\node_modules\pg-protocol\dist\parser.js:39:38)
      at Socket.<anonymous> (C:\fontes\0180947\b\Dev\VsCode\AmzBot\node_modules\pg-protocol\dist\index.js:11:42)
      at Socket.emit (events.js:315:20)
      at addChunk (internal/streams/readable.js:309:12)
      at readableAddChunk (internal/streams/readable.js:284:9)
      at Socket.Readable.push (internal/streams/readable.js:223:10)
      at TCP.onStreamRead (internal/stream_base_commons.js:188:23) {
    length: 175,
    severity: 'FATAL',
    code: '28000',
    hint: undefined,
    position: undefined,
    internalPosition: undefined,
    internalQuery: undefined,
    where: undefined,
    schema: undefined,
    table: undefined,
    column: undefined,
    dataType: undefined,
    constraint: undefined,
    file: 'auth.c',
    line: '545',
    routine: 'ClientAuthentication'
  }
}
Done!