bruno_kiafuka
02/11/2022, 4:38 PMsignIn()
method.
I've added the users into my `auth.users`table using a sql dump from another PostgreSQL db (modified it a bit so I could add the required fields), now when I try running supabase.auth.signIn()
passing the users' `email`and password
I get the following error:
json
"error": {
"message": "Database error querying schema",
"status": 500
}
Yet, If I add a new user using the signUp()
method I am able to login the newly created user without any problems. Is there any thing that I might have done wrong on during the migration process?
> I looked into this discussion https://github.com/supabase/supabase/discussions/3440 and I am unsure if they are related issues as I am not self hosting the db.
Thanks in advance 🙂garyaustin
02/11/2022, 4:40 PMbruno_kiafuka
02/11/2022, 4:45 PMsql
insert into auth.users (id, instance_id, aud, role, email, encrypted_password, email_confirmed_at, confirmation_token, recovery_token, email_change, last_sign_in_at, raw_app_meta_data, raw_user_meta_data, is_super_admin, created_at, updated_at, email_change_token_new, invited_at, confirmation_sent_at)
values ('<uuid on old db>', '00000000-0000-0000-0000-000000000000', 'authenticated', 'authenticated', '<my email>', '<my hashed pw>', '2021-11-17T12:21:32.447Z', '', '', '', '2021-11-16T12:21:32.447Z', '{"provider":"email","providers":["email"]}', '{}', false, '2021-11-16T12:21:32.447Z', '2021-11-16T12:21:32.447Z', '', '2021-11-17T12:21:32.447Z', '2021-11-17T12:21:32.447Z');
I was able to sign in without any problem, 🤔 I wonder what would be difference.bruno_kiafuka
02/11/2022, 4:47 PMuuid, password, and email
for all existing users.garyaustin
02/11/2022, 4:47 PMgaryaustin
02/11/2022, 4:49 PMgaryaustin
02/11/2022, 4:51 PMbruno_kiafuka
02/11/2022, 4:55 PMsql
CREATE OR REPLACE FUNCTION auth.uid()
RETURNS uuid
LANGUAGE sql
STABLE
AS $function$
select
nullif(
coalesce(
current_setting('request.jwt.claim.sub', true),
(current_setting('request.jwt.claims', true)::jsonb ->> 'sub')
),
''
)::uuid
$function$
bruno_kiafuka
02/11/2022, 4:56 PMgaryaustin
02/11/2022, 4:58 PMbruno_kiafuka
02/11/2022, 5:01 PMgaryaustin
02/11/2022, 5:14 PMgaryaustin
02/11/2022, 5:29 PMbruno_kiafuka
02/11/2022, 6:57 PMbruno_kiafuka
02/11/2022, 6:58 PMbruno_kiafuka
02/11/2022, 9:17 PMbruno_kiafuka
02/11/2022, 9:18 PMgaryaustin
02/11/2022, 9:19 PMbruno_kiafuka
02/11/2022, 9:19 PMbruno_kiafuka
02/11/2022, 9:19 PMgaryaustin
02/11/2022, 9:20 PMgaryaustin
02/11/2022, 9:21 PMbruno_kiafuka
02/11/2022, 9:21 PMgaryaustin
02/11/2022, 9:22 PMgaryaustin
02/11/2022, 9:23 PMbruno_kiafuka
02/11/2022, 9:23 PMgaryaustin
02/11/2022, 9:25 PMgaryaustin
02/11/2022, 9:25 PMgaryaustin
02/11/2022, 9:26 PMbruno_kiafuka
02/11/2022, 9:40 PMgo
// IsNotFoundError returns whether an error represents a "not found" error.
func IsNotFoundError(err error) bool {
switch err.(type) {
case UserNotFoundError:
return true
case RefreshTokenNotFoundError:
return true
case InstanceNotFoundError:
return true
}
return false
}
based on https://github.com/netlify/gotrue/blob/919c35ee31af28780e92b57c91ec1fe97f6b8e1f/models/errors.go#L4 none of these is the error I am getting.garyaustin
02/11/2022, 9:41 PMbruno_kiafuka
02/11/2022, 9:41 PMgaryaustin
02/11/2022, 9:44 PMgaryaustin
02/11/2022, 9:45 PMbruno_kiafuka
02/11/2022, 9:46 PMgaryaustin
02/11/2022, 10:03 PMbruno_kiafuka
02/14/2022, 10:22 AMbruno_kiafuka
02/14/2022, 11:43 AMbruno_kiafuka
02/14/2022, 7:48 PM