Currently, I am utilizing supabase for user authentication purposes. My goal is to display a message in the console if the authentication process fails. However, despite my best efforts, I am unable to get the console.log function to work as expected. While I have confirmed that the function itself is functioning properly by successfully implementing redirection in case of errors, I still desire to have the error message logged in the console.
'use server'
import { revalidatePath } from 'next/cache'
import { redirect } from 'next/navigation'
import { createClient } from '../../utils/supabase/server'
export async function login() {
const supabase = await createClient()
const { data, error } = await supabase.auth.signInAnonymously()
if (error) {
console.log(error)
// redirect('/anonlogin')
} else {
revalidatePath('/', 'layout')
redirect('/')
}
}