Client connection refused by default when running on Node 22
Describe the bug After upgrading from node 20 to node v22.12.0 (LTS), running my project locally this error occurred:
A client connection error occurred; reconnecting because of "waitUntilAvailable=30000". ClientConnectionClosedError: network error: Error: connect ECONNREFUSED ::1:10705
at <unknown> (ClientConnectionClosedError: network error: Error: connect ECONNREFUSED ::1:10705) {
[cause]: Error: connect ECONNREFUSED ::1:10705
at <unknown> (Error: connect ECONNREFUSED ::1:10705) {
errno: -4078,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '::1',
port: 10705
}
}
This happens when trying to sign in via emailPasswordSignIn server action (using @edgedb/auth-nextjs 0.4.0-canary.20241211T200202)
But I can connect to my instance REPL, and run the command edgedb ui and browse the database, that all works.
Reproduction How I create my client & auth:
// edgedb.ts
import createAuth from "@edgedb/auth-nextjs/app";
import { createClient } from "edgedb";
export const client = createClient({
tlsSecurity: process.env.NODE_ENV === "development" ? "insecure" : "default",
});
export const auth = createAuth(client, {
"https://localhost:3000",
passwordResetPath: "/reset-password",
});
Code that produces the error:
// auth.ts (auth related server actions)
import { auth } from "@/edgedb";
const { emailPasswordSignIn } = auth.createServerActions();
export const signInAction = async (formData: FormData) => {
const tokenData = await emailPasswordSignIn(formData);
// ^-- bug occurs happens here when this function is called
}
Expected behavior I expect the client to connect properly and be able to use the auth extention.
Versions
OS: Windows 11 Pro 23H2 build 22631.4602 with WSL2 on Ubuntu 22.04.3 LTS
EdgeDB server: 5.7+a084c4f (also occurs on 5.6+51fd5fe before upgrading)
EdgeDB CLI: 6.0.2+275a1ad
edgedb-js: 0.4.0-canary.20241211T200202 (also occurs on 0.3.2)
Node: 22.12.0 (20.18.1 works)
Additional context
- Workaround:
running
edgedb configure set listen_addresses 127.0.0.1 ::1via the cli (source docs) results in:select cfg::DatabaseConfig.listen_addresses; { '::1', '127.0.0.1' } - Possibly related issues: https://github.com/edgedb/edgedb-js/issues/413 (related to just generating code via edgedb-js?) https://github.com/edgedb/edgedb/issues/3932 (old? can probably be closed) https://github.com/edgedb/edgedb-examples/issues/94 (related to deno) https://github.com/edgedb/edgedb-js/issues/376 (another one related to deno)
- Possibly already defaults to
::1? https://github.com/edgedb/edgedb-cli/pull/798