Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: fetch failed DEPTH_ZERO_SELF_SIGNED_CERT #1041

Open
perevezencev opened this issue Jun 16, 2024 · 3 comments
Open

TypeError: fetch failed DEPTH_ZERO_SELF_SIGNED_CERT #1041

perevezencev opened this issue Jun 16, 2024 · 3 comments

Comments

@perevezencev
Copy link

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-js version (e.g. 0.20.10;): 1.5.7
  • Node/Deno version: node v21.6.2
@perevezencev
Copy link
Author

perevezencev commented Jun 16, 2024

On bun error look like this:

 ⨯ DEPTH_ZERO_SELF_SIGNED_CERT: self signed certificate
 path: "https://localhost:10705/db/edgedb/ext/auth/authenticate"
image

@scotttrinh
Copy link
Collaborator

scotttrinh commented Jun 17, 2024

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?

@perevezencev
Copy link
Author

Yes, I'm using @edgedb/auth-nextjs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants