postgres icon indicating copy to clipboard operation
postgres copied to clipboard

Error: Unknown auth message code 1375731712

Open Dreamkarifha9 opened this issue 4 years ago • 20 comments

Error: Unknown auth message code 1375731712 at Connection.handleAuth (connection.ts:216:15) at Connection.startup (connection.ts:170:16) at async Client.connect (client.ts:163:5) at async RegisteractModel.findfristpage (Registeract_test.ts:104:7) at async getFristpage (RegisterController_test.ts:19:19) at async dispatch (middleware.ts:39:7) at async authMiddleware (authMiddleware.ts:17:7) at async dispatch (middleware.ts:39:7) at async dispatch (middleware.ts:39:7) at async dispatch (middleware.ts:39:7)

Dreamkarifha9 avatar Feb 04 '21 10:02 Dreamkarifha9

Another One

PartialReadError: Encountered UnexpectedEof, data only partially read at BufReader.readFull (bufio.ts:183:19) at async Connection.readMessage (connection.ts:120:5) at async Connection._simpleQuery (connection.ts:313:11) at async Connection.query (connection.ts:589:16) at async RegisteractModel.findfristpage (Registeract_test.ts:115:22) at async getFristpage (RegisterController_test.ts:19:19) at async dispatch (middleware.ts:39:7) at async authMiddleware (authMiddleware.ts:17:7) at async dispatch (middleware.ts:39:7) at async dispatch (middleware.ts:39:7)

Dreamkarifha9 avatar Feb 04 '21 10:02 Dreamkarifha9

I made the same mistake const dbPool = new Pool({ user: "postgres", password: "123456", database: "deno", hostname: "192.168.18.200", port: 5432, }, POOL_CONNECTIONS);

error: Uncaught (in promise) Error: Unknown auth message code 10 throw new Error(Unknown auth message code ${code}); ^ at Connection.handleAuth (connection.ts:216:15) at Connection.startup (connection.ts:170:16) at async Pool._createConnection (pool.ts:38:5) at async pool.ts:67:7 at async Promise.all (index 3) at async Pool._startup (pool.ts:69:25) at async Pool.connect (pool.ts:90:5) at async runQueryObject (database.ts:14:30) at async app.ts:6:1

seilon-zhang avatar Feb 04 '21 11:02 seilon-zhang

Hi there @Dreamkarifha9 and @seilon-zhang

Could you please provide information about your Postgres server setup? Specifically what authentication method are you using and Postgres version,

The next thing in the todo list is to provide other connection methods different than standard user password authentication

SSL/TLS for example aren't supported right now, but knowing what other authentication methods could be supported in the meanwhile will be of great help

Soremwar avatar Feb 04 '21 12:02 Soremwar

The database version used is 13, which is the default setting, and no other changes have been made

seilon-zhang avatar Feb 04 '21 13:02 seilon-zhang

@Soremwar I've browsed your previous questions and answers, which should be about the verification of the screen-sha-256

seilon-zhang avatar Feb 04 '21 13:02 seilon-zhang

@seilon-zhang You are right. I will be adding support for this authentication method in the following days

@Dreamkarifha9 I just released a new version that parses the Postgres error messages instead of just showing the error code. Could you pleased update adn tell me what the new error tells you

Soremwar avatar Feb 04 '21 14:02 Soremwar

@Soremwar

I have updated to the last version. 0.7.0

Error Another

Error: Unknown auth message code 1375731712 at Connection.handleAuth (connection.ts:216:15) at Connection.startup (connection.ts:170:16) at async Client.connect (client.ts:163:5) at async RegisteractModel.findfristpage (Registeract_test.ts:104:7) at async getFristpage (RegisterController_test.ts:19:19) at async dispatch (middleware.ts:39:7) at async authMiddleware (authMiddleware.ts:17:7) at async dispatch (middleware.ts:39:7) at async dispatch (middleware.ts:39:7) at async dispatch (middleware.ts:39:7)

My setting Config.ts

const dbConfigsetup: ConnectionOptions = { user: "postgres", password: "", database: "", hostname: "", port: 5432, }; export const config: Config = { dbConfigsetup, jwtSecret: Deno.env.get("JWT_SECRET")!, };

My setting Controller

export async function getFristpage(ctx: RouterContext) { try { const { response } = ctx; const posts = await Registeract.findfristpage(); response.status = 200; response.body = posts; } catch (error) { console.log(error); throw error; } }

My setting modules

class RegisteractModel { private dbClient: Client;

constructor(dbClient: Client) { this.dbClient = dbClient; }

async findfristpage(): Promise { try { await this.dbClient.connect(); const text = SELECT machineactivitydetails.id, machineactivitydetails.actcode, machineactivitydetails.description as actdescription, machineactivitydetails.duratypeid, machineactivitydetails.is_active, machineactivitydetails.update_date, machinedetails.idmachine, machineactivitydetails.update_by, duratype.description, duratype.dura_day, machinedetails.name, machinedetails.orders, machineactivitydetails.machinegroupid, machinegroup.name as machinegroupname, machineactivitydetails.machinedetailsid, machineactivitydetails.standard FROM machineactivity AS machineactivitydetails LEFT JOIN duratype on duratype.id = machineactivitydetails.duratypeid LEFT JOIN machinedetails on machinedetails.id = machineactivitydetails.machinedetailsid LEFT JOIN machinegroup on machinegroup.id = machineactivitydetails.machinegroupid ORDER BY machineactivitydetails.id DESC LIMIT 10 ;; const result = await this.dbClient.queryObject({ text, }); await this.dbClient.end(); return result.rows; } catch (error) { console.log(error); throw error; } }

}

Dreamkarifha9 avatar Feb 05 '21 01:02 Dreamkarifha9

@Dreamkarifha9 The patch to check the error was released on 0.7.1 :/

Soremwar avatar Feb 05 '21 01:02 Soremwar

@Soremwar

update on 0.7.1 error

Error: Unknown auth message code 1375731712 at Connection.handleAuth (connection.ts:233:15) at Connection.startup (connection.ts:171:16) at async Client.connect (client.ts:163:5) at async RegisteractModel.findfristpage (Registeract_test.ts:104:7) at async getFristpage (RegisterController_test.ts:19:19) at async dispatch (middleware.ts:39:7) at async authMiddleware (authMiddleware.ts:17:7) at async dispatch (middleware.ts:39:7) at async dispatch (middleware.ts:39:7) at async dispatch (middleware.ts:39:7)

Another one error BadResource: Bad resource ID
at unwrapResponse (deno:cli/rt/10_dispatch_minimal.js:59:13) at sendAsync (deno:cli/rt/10_dispatch_minimal.js:98:12) at async read (deno:cli/rt/12_io.js:99:19) at async BufReader.read (bufio.ts:146:12) at async BufReader.readFull (bufio.ts:178:20) at async Connection.readMessage (connection.ts:120:5) at async Connection.startup (connection.ts:170:11) at async Client.connect (client.ts:163:5) at async RegisteractModel.findfristpage (Registeract_test.ts:104:7) at async getFristpage (RegisterController_test.ts:19:19)

Dreamkarifha9 avatar Feb 05 '21 02:02 Dreamkarifha9

@Dreamkarifha9 Ok, so it doesn't seem to be a connection error

What method are you using to authenticate with your database? Plain password? SSL? TLS?

Soremwar avatar Feb 05 '21 02:02 Soremwar

@Soremwar

I use setup

const dbConfigsetup: ConnectionOptions = { user: "postgres", password: "200711", database: "", hostname: "", port: 5432, }; export const config: Config = { dbConfigsetup, }; export { database, dbconfig };

How am i supposed To do that?

Dreamkarifha9 avatar Feb 05 '21 02:02 Dreamkarifha9

No, I mean how is your database configured. Or if you are using a database provided as a service (Amazon, Azure, etc) which one are you using and what are your settings?

I'm trying to understand what the driver is lacking in order to connect to your database

Soremwar avatar Feb 05 '21 02:02 Soremwar

@Soremwar

I use postgresql
And i use Docker on windows serve

Dreamkarifha9 avatar Feb 05 '21 02:02 Dreamkarifha9

Did you configured the docker image yourself?

Also can you come to the discord server? It's kinda annoying trying to figure out the issue this way

Soremwar avatar Feb 05 '21 02:02 Soremwar

Yes, I can ask your discord server

Dreamkarifha9 avatar Feb 05 '21 02:02 Dreamkarifha9

I'm in the postgres channel, the link is in the README

Soremwar avatar Feb 05 '21 02:02 Soremwar

Ok

Dreamkarifha9 avatar Feb 05 '21 02:02 Dreamkarifha9

@Soremwar Not sure what the status of this issue is, but here is an observation I made: The binary representation of 1375731712 is: 1010010000000000000000000000000 The first byte (byte1) is: 1010010 (82, 0x52) which happens to be the ASCII character 'R'


It is possible that the error is for a Routine error. As defined in section 52.8 of the PostgreSQL 13 manual, the ErrorResponse and NoticeResponse messages can contain different fields, one of which is the R field. The description is as follows: "Routine: the name of the source-code routine reporting the error."


Another possibility is that the error code might be one of the postgres Logical Replication Message Formats as defined in section 52.9 of the PostgreSQL 13 manual. The Byte1('R') is for the Relation Logical Replication Message Format.

EliSauder avatar Apr 19 '21 00:04 EliSauder

Same error:

PartialReadError: Encountered UnexpectedEof, data only partially read
    at BufReader.readFull (https://deno.land/[email protected]/io/buffer.ts:420:19)
    at async Connection.#readMessage (https://deno.land/x/[email protected]/connection/connection.ts:168:5)
    at async Connection.#preparedQuery (https://deno.land/x/[email protected]/connection/connection.ts:904:25)
    at async Connection.query (https://deno.land/x/[email protected]/connection/connection.ts:930:16)

iugo avatar Mar 03 '22 06:03 iugo

I have same error on version 0.16.1

Error: Unknown auth message code 1375731712
    at Connection.#authenticate (https://deno.land/x/[email protected]/connection/connection.ts:550:15)
    at Connection.#startup (https://deno.land/x/[email protected]/connection/connection.ts:412:31)
    at async Connection.startup (https://deno.land/x/[email protected]/connection/connection.ts:491:11)
    at async Connection.query (https://deno.land/x/[email protected]/connection/connection.ts:943:7)
    at async Client.#executeQuery (https://deno.land/x/[email protected]/client.ts:245:12)
    at async Client.queryObject (https://deno.land/x/[email protected]/client.ts:433:12)

For

config = {
  hostname: 'localhost',
  port: 5432,
  database: 'myDb'
  user: <user>,
  password: <password>,
}

new Client({...config, tls: { enabled: false }});

Without tls: { enabled: false } it gives other error

Error: Could not check if server accepts SSL connections, server responded with: 69
    at Connection.#serverAcceptsTLS (https://deno.land/x/[email protected]/connection/connection.ts:200:15)
    at async Connection.#startup (https://deno.land/x/[email protected]/connection/connection.ts:344:29)
    at async Connection.startup (https://deno.land/x/[email protected]/connection/connection.ts:491:11)
    at async Connection.query (https://deno.land/x/[email protected]/connection/connection.ts:943:7)
    at async Client.#executeQuery (https://deno.land/x/[email protected]/client.ts:245:12)
    at async Client.queryObject (https://deno.land/x/[email protected]/client.ts:433:12)

It happens when i send two query in very short time to the database.

Aha after asking right person I've understand that don't use db in right way and should use Lazy pools

SpiritOfSpirt avatar Oct 12 '22 10:10 SpiritOfSpirt