cli: Cannot create a new user on dev server

Bug report

Describe the bug

I cannot create a user either with JS or via Studio.

To Reproduce

JS (1)

Example from https://supabase.com/docs/reference/javascript/auth-api-createuser seems wrong.

// error TS2345: Argument of type '{ name: string; }' is not assignable to parameter of type 'UserAttributes'.
const { data: user, error } = await supabase.auth.api.createUser({ name: 'Yoda' });

image

JS (2)

Instead I use following:

// I got error: { message: 'Database error checking email', status: 500 }
const { data: user, error} = await supabase.auth.api.createUser({ email: "abc@xyz.com", data: {name: 'Yoda'} });

Studio

I try to use Authetication/Users/Invite, but got error “Failed to invite user: Database error finding user”

image

supabase/supabase#4268 mentions disabling e-mail confirmation, but I can’t find how to do it in the local dev studio.

System information

macOS 11

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

You should be able to monitor & click the confirmation email on the inbucket port (http://localhost:54324): Screen Shot 2021-12-17 at 5 53 13 PM

I found a workaround. I’m sharing here if anyone needs it until a proper solution is developed.

To create a user in development server:

  1. Update supabase/config.json file and add ports.inbucket key with a port value. (i.e. 54324)
  2. Restart supabase server.
  3. Create a client, using the “Service Role Key”.
  4. Create a user with mail and password:
const supabase = createClient('http://localhost:54321', SERVICE_ROLE_KEY);
const { data: user, error} = await supabase.auth.api.createUser({
  email: "abc@xyz.com",
  password: "password",
  data: {name: 'Yoda'}
})`;
  1. Open Supabase database using your favorite PostgreSQL client. (i.e. pgAdmin)
  2. Open auth.users table and update the user by setting email_confirmed_at column to a date. (i.e. ‘2012-12-01 00:00:00’)

Now, you have a verified user and can use await supabase.auth.signIn({ email: "abc@xyz.com", password: "password" });

@soedirgo, thank you. I didn’t know that it is a connectable web-based app.