mtxr / vscode-sqltools

Database management for VSCode

Home Page:https://vscode-sqltools.mteixeira.dev?utm_source=github&utm_medium=homepage-link

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ERROR (ls): TypeError [ERR_INVALID_ARG_TYPE]

p3k opened this issue · comments

Describe the bug
When I try to connect to a PostgreSQL database server on localhost, the connection times out.

In the output console of VSCodium I see this error/stack trace:

[1710440564318] ERROR (ls): TypeError [ERR_INVALID_ARG_TYPE]: The "key" argument must be of type string or an instance of ArrayBuffer, Buffer, TypedArray, DataView, KeyObject, or CryptoKey. Received null
    at new NodeError (node:internal/errors:405:5)
    at prepareSecretKey (node:internal/crypto/keys:596:11)
    at new Hmac (node:internal/crypto/hash:134:9)
    at Object.createHmac (node:crypto:165:10)
    at Mr (/home/tobi/.vscode-oss/extensions/mtxr.sqltools-driver-pg-0.5.1-universal/out/ls/plugin.js:1:16978)
    at xy (/home/tobi/.vscode-oss/extensions/mtxr.sqltools-driver-pg-0.5.1-universal/out/ls/plugin.js:1:17049)
    at Object.Dy [as continueSession] (/home/tobi/.vscode-oss/extensions/mtxr.sqltools-driver-pg-0.5.1-universal/out/ls/plugin.js:1:15612)
    at Ri._handleAuthSASLContinue (/home/tobi/.vscode-oss/extensions/mtxr.sqltools-driver-pg-0.5.1-universal/out/ls/plugin.js:2:30636)
    at Yo.emit (node:events:514:28)
    at /home/tobi/.vscode-oss/extensions/mtxr.sqltools-driver-pg-0.5.1-universal/out/ls/plugin.js:2:24842

To Reproduce
Steps to reproduce the behavior:

  1. Click the SQLTools icon
  2. Add new connection
  3. Click the “Test connection” button
  4. See error

Expected behavior
Getting a connection to the local PG database server.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • SQLTools Version 0.28.1
  • VS Code Version: 1.87.0 (VSCodium)
    • Release: 24060
    • Commit: 5695cc889d3d0500fa6c7983468a699185fce828
    • Date: 2024-02-29T23:06:19.600Z
    • Electron: 27.3.2
    • ElectronBuildId: undefined
    • Chromium: 118.0.5993.159
    • Node.js: 18.17.1
    • V8: 11.8.172.18-electron.0
  • OS: Linux x64 6.5.0-17-generic snap
  • Driver:
    • PostgreSQL/Redshift 0.5.1 (actually, it is called PostgreSQL/Cockroach…)
    • MySQL/MariaDB 0.5.1
    • MSSQL/Azure
    • SQLite 0.5.0
    • Other? Which...
  • Database version: PostgreSQL 14.11

Additional context

The connection configuration:

{
	"sqltools.connections": [
		{
			"previewLimit": 50,
			"server": "localhost",
			"port": 5432,
			"driver": "PostgreSQL",
			"name": "Local DB",
			"database": "postgres",
			"username": "tobi",
			"connectionTimeout": 3,
			"askForPassword": false,
			"password": ""
		}
	]
}

I have a mapping in /etc/postgres/14/main/pg_ident.conf and can connect via psql without any issues:

$ sudo tail -2 /etc/postgresql/14/main/pg_ident.conf
# MAPNAME       SYSTEM-USERNAME         PG-USERNAME
localhost	tobi			postgres

$ psql -U tobi
psql (14.11 (Ubuntu 14.11-1.pgdg22.04+1))
Type "help" for help.

postgres=#