edgedb-js icon indicating copy to clipboard operation
edgedb-js copied to clipboard

error generating query builder

Open haikyuu opened this issue 1 year ago • 10 comments

Running npx edgeql-js throws

Detected package.json. Generating .js files with CommonJS module syntax.
   To override this, use the --target flag.
   Run `npx edgeql-js --help` for details.
Generating query builder into ./dbschema/edgeql-js
Connecting to EdgeDB instance...
Introspecting database schema...
A client connection error occurred; reconnecting because of "waitUntilAvailable=30000". ClientConnectionClosedError: network error: Error: connect ECONNREFUSED ::1:10726
    at RawConnection._onError
at TLSSocket.emit (node:events:513:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  source: Error: connect ECONNREFUSED ::1:10726
      at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1247:16) {
    errno: -61,
    code: 'ECONNREFUSED',
    syscall: 'connect',
    address: '::1',
    port: 10726
  }
}

Running on Macos

haikyuu avatar Aug 05 '22 07:08 haikyuu

Hey, are you able to connect to the instance via CLI or other methods?

Sikarii avatar Aug 05 '22 09:08 Sikarii

yes image

The version warning is weird and doesn't want to go. But I can connect.

Is it ipv4 vs ipv6 thing?

haikyuu avatar Aug 06 '22 06:08 haikyuu

It worked after unlinking and project init again. Version was updated to 2.1, so I suppose the bug was fixed somehow.

edgedb project unlink
edgedb project init

Will open if I face it again

haikyuu avatar Aug 06 '22 06:08 haikyuu

Hey, @haikyuu , I'm still having the same issue, even after edgedb project unlink and edgedb project init. Using 2.1+c73716f, but running on Windows 10

If I try to specify the instance name with npx edgeql-js -I edgedb, I get an additional error:

Hint: it looks like the program is running from a directory initialized with "edgedb project init". Consider calling "edgedb.connect()" without arguments.

themajashurka avatar Aug 25 '22 07:08 themajashurka

Colin, please take a look

1st1 avatar Aug 26 '22 20:08 1st1

I am hitting the same issue it seems. I just installed edgedb via the powershell installer. edgedb works along with the other edgedb subcommands, but all edgeql-js commands fail to connect.

I'm on Windows 11.

EdgeDB CLI 2.0.5+da7c868

edgedb project upgrade --to-latest Latest version found 2.1+c73716f, current instance version is 2.1+c73716f. Already up to date.

Example output:

Generating query builder...
Detected tsconfig.json, generating TypeScript files.
   To override this, use the --target flag.
   Run `npx edgeql-js --help` for full options.
Introspecting database schema...
A client connection error occurred; reconnecting because of "waitUntilAvailable=30000". ClientConnectionClosedError: network error: Error: connect ECONNREFUSED ::1:10700
    at RawConnection._onError (C:\Users\andye\Development\eskridge.dev\node_modules\edgedb\dist\rawConn.js:115:24)
    at TLSSocket.emit (node:events:537:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  source: Error: connect ECONNREFUSED ::1:10700
      at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1237:16) {
    errno: -4078,
    code: 'ECONNREFUSED',
    syscall: 'connect',
    address: '::1',
    port: 10700
  }
}
Terminate batch job (Y/N)? Y

I was able to get a different error by defining the host and port:

Generating query builder...
Detected tsconfig.json, generating TypeScript files.
   To override this, use the --target flag.
   Run `npx edgeql-js --help` for full options.
Introspecting database schema...
A client connection error occurred; reconnecting because of "waitUntilAvailable=30000". ClientConnectionClosedError: network error: Error: self-signed certificate
    at RawConnection._onError (C:\Users\andye\Development\eskridge.dev\node_modules\edgedb\dist\rawConn.js:115:24)
    at TLSSocket.emit (node:events:537:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  source: Error: self-signed certificate
      at TLSSocket.onConnectSecure (node:_tls_wrap:1533:34)
      at TLSSocket.emit (node:events:537:28)
      at TLSSocket._finishInit (node:_tls_wrap:947:8)
      at ssl.onhandshakedone (node:_tls_wrap:728:12) {
    code: 'DEPTH_ZERO_SELF_SIGNED_CERT'
  }
}


Hint: it looks like the program is running from a directory initialized with "edgedb project init". Consider calling "edgedb.connect()" without arguments.```

andyeskridge avatar Aug 31 '22 03:08 andyeskridge

I've found a solution with which I could finally connect and generate the builder successfully. Configure your instance with this once:

edgedb configure set listen_addresses 127.0.0.1 ::1 then npx edgeql-js

It is indeed a WSL ip4/6 anomaly, but i'm not an expert by any means. Some reference here: #376

themajashurka avatar Aug 31 '22 15:08 themajashurka

This happens to me with node v18.

But works with node v16!

MiroslavPetrik avatar Nov 04 '22 08:11 MiroslavPetrik