mtxr / vscode-sqltools

Database management for VSCode
https://vscode-sqltools.mteixeira.dev?utm_source=github&utm_medium=homepage-link
MIT License
1.43k stars 290 forks source link

ERROR (ls): TypeError [ERR_INVALID_ARG_TYPE] #1297

Open p3k opened 3 months ago

p3k commented 3 months ago

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):

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=#