Skip to content

Google sign-in fails with "Database error saving new user" (Supabase trigger failure) — blocks all new signups #27

Description

@Haris0059

Summary

Signing in to https://hyperspace.sh with Google (the only available auth method) consistently fails. After completing the Google OAuth consent screen, the user is redirected back to the landing page with this URL:

https://hyperspace.sh/?error=server_error&error_code=unexpected_failure&error_description=Database+error+saving+new+user#error=server_error&error_code=unexpected_failure&error_description=Database+error+saving+new+user&sb=

No account is created and there is no way to proceed. The same error also occurs when running hyperspace login from the CLI — so this is not a browser-specific issue; the failure is server-side in the Supabase Auth flow.

Likely cause

This is a known Supabase Auth failure mode. error_description=Database error saving new user is returned when the on_auth_user_created trigger (or equivalent function inserting into public.profiles / public.users) raises an exception during the auth.users insert. Common root causes:

  • A NOT NULL column in the profiles table that the trigger doesn't populate (e.g. username, full_name, avatar_url).
  • Missing GRANTs / RLS policy blocking the trigger's insert under the supabase_auth_admin role.
  • A unique constraint collision (e.g. username derived from email).
  • A recent schema change to the profiles table that wasn't reflected in the trigger function.

Because the failure happens inside the Auth transaction, Supabase rolls back and no row exists in auth.users — retrying doesn't help, and there's no client-side workaround.

Reproduction

Web:

  1. Open https://hyperspace.sh in a fresh browser session (no prior account).
  2. Click sign in → continue with Google.
  3. Complete the Google consent flow.
  4. Redirected to the landing page with the error querystring above.

CLI:

  1. Run hyperspace login.
  2. Complete the Google OAuth in the browser.
  3. Same Database error saving new user is returned.

Impact

Sign-up is fully blocked for new users on both web and CLI — Google is the only auth method offered.

Suggested fix

Check the Supabase project logs (Auth → Logs, or select * from auth.audit_log_entries order by created_at desc) for the underlying Postgres exception, then patch the handle_new_user trigger function accordingly. An email/password fallback would also unblock users while this is being investigated.

Environment

  • Browser: Zen
  • OS: Linux
  • Date observed: 2026-05-20
  • Affected surfaces: web (hyperspace.sh) and CLI (hyperspace login)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions