Can you show the definition for your profiles
table? I also ran into issues when setting triggers up and it ended up being something small that just needed to be tweaked.
if you check the logs it will usually throw an error you can see what it's complaining about. If you want, you can adjust the function to log an error so you can see what the problem is.
CREATE OR REPLACE FUNCTION handle_new_user() RETURNS trigger AS $$
BEGIN
INSERT INTO profiles (id, full_name, avatar_url)
VALUES (
new.id,
new.raw_user_meta_data->>'full_name',
new.raw_user_meta_data->>'avatar_url'
)
ON CONFLICT (id) DO NOTHING; -- This will ignore the insert if the id already exists
RETURN NEW;
EXCEPTION
WHEN OTHERS THEN
RAISE WARNING 'An error occurred while handling the new user: %', SQLERRM;
RETURN NEW;
END;
$$ LANGUAGE plpgsql SECURITY DEFINER;
CREATE TRIGGER on_auth_user_created
AFTER INSERT ON auth.users
FOR EACH ROW EXECUTE PROCEDURE handle_new_user();
There's no reason why the code above shouldn't work as long as you have a profiles table with an id, full_name and avatar_url field. If its still not working then definitely check the logs to see why.
Hope this helps!