Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to provide username and password in postgresql connection URI #106

Open
tangentus opened this issue Feb 3, 2024 · 0 comments
Open

Comments

@tangentus
Copy link

When executing DS_PORT=3001 DWN_STORAGE=postgres://postgres:postgres@0.0.0.0:5432/dwn npm run server an error log is given. After checking my postgres logs it seems that the underlying postgres driver is defaulting to the $USER environment variable when connecting to the database instead of the username provided in the connection URI.

Node version: Node.js v18.19.0
Package version: latest (main)

Note That you can get it working by setting the PGUSER and PGPASSWORD environment variables and leave them out of the connection URI. This took a bit of digging to figure out which env variables are being looked for 😓
PGUSER=postgres PGPASSWORD=postgres DS_PORT=3001 DWN_STORAGE=postgres://0.0.0.0:5432/dwn npm run server

/Users/noone/src/dwn-server/node_modules/pg-pool/index.js:45
    Error.captureStackTrace(err);
          ^

Error: SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string
    at /Users/noone/src/dwn-server/node_modules/pg-pool/index.js:45:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async PostgresDriver.acquireConnection (file:///Users/noone/src/dwn-server/node_modules/kysely/dist/esm/dialect/postgres/postgres-driver.js:19:24)
    at async RuntimeDriver.acquireConnection (file:///Users/noone/src/dwn-server/node_modules/kysely/dist/esm/driver/runtime-driver.js:44:28)
    at async DefaultConnectionProvider.provideConnection (file:///Users/noone/src/dwn-server/node_modules/kysely/dist/esm/driver/default-connection-provider.js:8:28)
    at async DefaultQueryExecutor.executeQuery (file:///Users/noone/src/dwn-server/node_modules/kysely/dist/esm/query-executor/query-executor-base.js:34:16)
    at async CreateTableBuilder.execute (file:///Users/noone/src/dwn-server/node_modules/kysely/dist/esm/schema/create-table-builder.js:315:9)
    at async RegistrationStore.initialize (file:///Users/noone/src/dwn-server/dist/esm/src/registration/registration-store.js:20:9)
    at async RegistrationStore.create (file:///Users/noone/src/dwn-server/dist/esm/src/registration/registration-store.js:16:9)
    at async RegistrationManager.create (file:///Users/noone/src/dwn-server/dist/esm/src/registration/registration-manager.js:62:35)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant