edgedb / edgedb-examples

EdgeDB example projects for different stacks
61 stars 22 forks source link

Deno Fresh ConnectionRefused #94

Open zigomir opened 1 year ago

zigomir commented 1 year ago

Hi,

after doing edgedb project init I can run edgedb ui and see Count object and all, but when I run deno task start and open http://localhost:8000/ I get this error:

A client connection error occurred; reconnecting because of "waitUntilAvailable=30000". ClientConnectionClosedError: network error: ConnectionRefused: Connection refused (os error 61)
    at RawConnection._onError (https://deno.land/x/edgedb@v0.21.1/_src/rawConn.ts:110:20)
    at TLSSocket.emit (https://deno.land/std@0.114.0/node/events.ts:167:20)
    at https://deno.land/x/edgedb@v0.21.1/_src/adapter.deno.ts:281:16

Instance is supposed to be running

edgedb instance list
┌───────┬────────────┬───────┬─────────────┬──────────┐
│ Kind  │ Name       │ Port  │ Version     │ Status   │
├───────┼────────────┼───────┼─────────────┼──────────┤
│ local │ deno_fresh │ 10701 │ 2.0+88c1706 │ running  │

I have no idea where to look next 😊

[edit] Actually I see same thing for Remix when running npx edgeql-js.

tailhook commented 1 year ago

Do you run deno task start and npx edgeql-js from the same directory where your edgedb project init was run?

jaclarke commented 1 year ago

On some platforms Deno resolves localhost to the ipv6 address ::1, and edgedb by default listens on 127.0.0.1, so you may need to configure edgedb to listen on ::1 as well. (eg: edgedb configure set listen_addresses 127.0.0.1 ::1)

zigomir commented 1 year ago

Yes, edgedb configure set listen_addresses 127.0.0.1 ::1 fixed my problem for the deno-fresh example. But running npx edgeql-js from remix directory still gets me:

npx edgeql-js
Detected tsconfig.json, generating TypeScript files.
   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:10702
    at RawConnection._onError (/Users/ziga/development/edgedb-examples/remix/node_modules/edgedb/dist/rawConn.js:115:24)
    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:10702
      at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1247:16) {
    errno: -61,
    code: 'ECONNREFUSED',
    syscall: 'connect',
    address: '::1',
    port: 10702
  }
}

Do you run deno task start and npx edgeql-js from the same directory where your edgedb project init was run?

Yep.

melkir commented 1 year ago

Here's the output I got on my side

~/Projects/edgedb-fresh main*
❯ edgedb configure set listen_addresses 127.0.0.1 ::1
OK: CONFIGURE INSTANCE

~/Projects/edgedb-fresh main*
❯ npx edgeql-js
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...
Generation successful!
Checking the generated query builder into version control
is NOT RECOMMENDED. Would you like to create a .gitignore file to ignore
the query builder directory? [y/n] (leave blank for "y")
> y

However nothing is being created on ./dbschema/edgeql-js 🤔