edgedb-js
edgedb-js copied to clipboard
TypeError: fetch failed DEPTH_ZERO_SELF_SIGNED_CERT
Describe the bug
Causing error then call emailPasswordSignIn
⨯ TypeError: fetch failed
at async $$ACTION_1 (./src/lib/auth.ts:31:5)
digest: "3961493417"
Cause: Error: self-signed certificate
at TLSSocket.onConnectSecure (node:_tls_wrap:1674:34)
at TLSSocket.emit (node:events:519:28)
at TLSSocket._finishInit (node:_tls_wrap:1085:8)
at ssl.onhandshakedone (node:_tls_wrap:871:12)
at TLSWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
code: 'DEPTH_ZERO_SELF_SIGNED_CERT'
}
Reproduction default.esdl
using extension auth;
module default {
global current_user := (
assert_single((
select User
filter .identity = global ext::auth::ClientTokenIdentity
))
);
type User {
required name: str;
required identity: ext::auth::Identity;
}
type Post {
required text: str;
required author: User;
access policy author_has_full_access
allow all
using (.author ?= global current_user);
access policy others_read_only
allow select;
}
}
page.tsx
export default function HomePage() {
function handleSubmit(e) {
e.preventDefault();
emailPasswordSignIn({
email: "[email protected]",
password: "3424",
});
}
return (
<main>
<form onSubmit={handleSubmit}>
<input type="email" name="email" />
<input type="password" name="password" />
<button type="submit">Update User Name</button>
</form>
</main>
);
}
Expected behavior Signing without error
Versions (please complete the following information):
- OS: macOS Sonoma
- EdgeDB version (e.g.
2.0): 5.4+06b93a6 - EdgeDB CLI version (e.g.
2.0): EdgeDB CLI 4.0.2+500be79 edgedb-jsversion (e.g.0.20.10;): 1.5.7- Node/Deno version: node v21.6.2
On bun error look like this:
⨯ DEPTH_ZERO_SELF_SIGNED_CERT: self signed certificate
path: "https://localhost:10705/db/edgedb/ext/auth/authenticate"
When developing locally, you either need to jump through all the hoops in your operating system to allow self-signed certificates or use EDGEDB_CLIENT_TLS_SECURITY=insecure environment variable which will use http instead of https when redirecting to the server.
I'll leave this issue open and add more detail in the documentation. You're using @edgedb/auth-nextjs?
Yes, I'm using @edgedb/auth-nextjs