Node-postgres: Facing error: no PostgreSQL user name specified in startup packet in x86 platform

Created on 3 Dec 2018  ยท  3Comments  ยท  Source: brianc/node-postgres

Have installed postgresql in x86 platform using command apt-get install postgresql.
While running npm install-test for the package facing error: no PostgreSQL user name specified in startup packet
Please guide me on solving this issue. Thanks in advance.
Please find below complete logs in x86_64 paltform:
root@30aeeb1c8338:/node-postgres# npm install-test
npm WARN [email protected] requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of pg@>5.0 but none is installed. You must install peer dependencies yourself.

audited 313 packages in 3.153s
found 0 vulnerabilities

[email protected] test /node-postgres
make test-all

Starting lint
node_modules/.bin/eslint lib
Testing optional native install
Cannot find module 'pg-native'
error-tests.js
connection emits stream errors โœ”
connection emits ECONNRESET errors during normal operation โœ”
connection does not emit ECONNRESET errors during disconnect โœ”
connection does not emit ECONNRESET errors during disconnect also when using SSL โœ”
connection emits an error when SSL is not supported โœ”
connection emits an error when postmaster responds to SSL negotiation packet โœ”

outbound-sending-tests.js...................
startup-tests.js.........
inbound-parser-tests.js..........................................................
environment-variable-tests.js............
creation-tests.js.................?.....
utils-tests.js.......................
query-queue-tests.js.........
escape-tests.js................
configuration-tests.js............
prepared-statement-tests.js...........
simple-query-tests.js..............?..
cleartext-password-tests.js..
stream-and-query-error-interaction-tests.js.
early-disconnect-tests.js
throw-in-type-parser-tests.js
emits error โœ”
calls callback with error โœ”
rejects promise with error โœ”

md5-password-tests.js....
result-metadata-tests.js.......
notification-tests.js.
Testing connection
(node:11074) UnhandledPromiseRejectionWarning: error: no PostgreSQL user name specified in startup packet
at Connection.parseE (/node-postgres/lib/connection.js:553:11)
at Connection.parseMessage (/node-postgres/lib/connection.js:378:19)
at Socket. (/node-postgres/lib/connection.js:119:22)
at Socket.emit (events.js:182:13)
at addChunk (_stream_readable.js:283:12)
at readableAddChunk (_stream_readable.js:264:11)
at Socket.Readable.push (_stream_readable.js:219:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
(node:11074) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:11074) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Testing Pure Javascript
bound-command-tests.js..

{ error: no PostgreSQL user name specified in startup packet at Connection.parseE (/node-postgres/lib/connection.js:553:11) at Connection.parseMessage (/node-postgres/lib/connection.js:378:19) at Socket. (/node-postgres/lib/connection.js:119:22) at Socket.emit (events.js:182:13) at addChunk (_stream_readable.js:283:12) at readableAddChunk (_stream_readable.js:264:11) at Socket.Readable.push (_stream_readable.js:219:10) at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17) name: 'error', length: 114, 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: 'postmaster.c', line: '2138', routine: 'ProcessStartupPacket' }
Message: Connection error
Error: Connection error
at Connection. (/node-postgres/test/integration/connection/test-helper.js:12:11)
at Connection.emit (events.js:182:13)
at Socket. (/node-postgres/lib/connection.js:123:12)
at Socket.emit (events.js:182:13)
at addChunk (_stream_readable.js:283:12)
at readableAddChunk (_stream_readable.js:264:11)
at Socket.Readable.push (_stream_readable.js:219:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)

xargs: node: exited with status 255; aborting
Makefile:53: recipe for target 'test-integration' failed
make: * [test-integration] Error 124
npm ERR! Test failed. See above for more details.

Most helpful comment

@haikyuu Issue got resolved after i have set my own password to postgres user. Below are the steps i have followed to resolve:
1) Need to set environment variables PGUSER and PGDATABASE as export PGDATABASE=postgres and export PGUSER=postgres
2) Need to install libpq-dev.
3) Set password for postgres user as postgres, for example.
4) Update password as postgres from null in lib/default.js, configuration-test.js.

All 3 comments

Hi @ossdev07 i'm getting the same error when running my project in a docker image. It runs fine locally though (in macos machine).

Did you manage to solve the issue?

@haikyuu Issue got resolved after i have set my own password to postgres user. Below are the steps i have followed to resolve:
1) Need to set environment variables PGUSER and PGDATABASE as export PGDATABASE=postgres and export PGUSER=postgres
2) Need to install libpq-dev.
3) Set password for postgres user as postgres, for example.
4) Update password as postgres from null in lib/default.js, configuration-test.js.

Thank you @ossdev07
I solved my issue as weel. It's indeed environment variables issue. ๐Ÿ‘
I guess we can close this issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AhmedBHameed picture AhmedBHameed  ยท  3Comments

Phara0h picture Phara0h  ยท  4Comments

gpanainte picture gpanainte  ยท  3Comments

lucasmrl picture lucasmrl  ยท  3Comments

KeynesYouDigIt picture KeynesYouDigIt  ยท  3Comments