[solved] Generating users in seed.sql

Hi folks,

I would like to generate a handful of users + public profiles in my local dev environment but I can't get it to work. I found some docs and GitHub discussions around the topic but it didn't help me solve the problem.

Ultimately, I created a user in the UI and logged in, to see which columns in the auth.users table will be filled. I then used this information in my seed.sql file. And while the users are actually showing up in the UI, when trying to log in (or sending a magic link from Studio), I am getting an Database error finding user / Failed to send magic link: Database error finding user error.

Here's a snippet from my seed.sql:

insert into auth.users (email, id, instance_id, aud, role, encrypted_password, invited_at, confirmation_sent_at, last_sign_in_at, raw_app_meta_data, raw_user_meta_data, created_at, updated_at, email_confirmed_at, email_change_confirm_status)
values
  ('user-1@example.com', 'bd59c1b6-949a-44fb-b0e1-fac10f7367a1', '00000000-0000-0000-0000-000000000000', 'authenticated', 'authenticated', '$2a$10$jFOTJvSGDgj5ImgfH3DLeezIZY6HOayJvlE80lY0VdVfdY.zo3h7u', now(), now(), now(), '{"provider":"email","providers":["email"]}', '{}', now(), now(), now(), 0),
  ('user-2@example.com', 'bd59c1b6-949a-44fb-b0e1-fac10f7367a2', '00000000-0000-0000-0000-000000000000', 'authenticated', 'authenticated', '$2a$10$jFOTJvSGDgj5ImgfH3DLeezIZY6HOayJvlE80lY0VdVfdY.zo3h7u', now(), now(), now(), '{"provider":"email","providers":["email"]}', '{}', now(), now(), now(), 0);


Am I missing something, or am I approaching this incorrectly?
Was this page helpful?