const test = async (req: any) => {
try {
// Set the Auth context of the user that called the function.
// This way your row-level-security (RLS) policies are applied.
supabaseClient.auth.setAuth(
req.headers.get("Authorization")!.replace("Bearer ", "")
);
const { data, error } = await supabaseClient.from("profiles").select("*");
console.log({ data, error });
return new Response(JSON.stringify({ data, error }), {
headers: { "Content-Type": "application/json" },
status: 200,
});
} catch (error) {
return new Response(JSON.stringify({ error: error.message }), {
headers: { "Content-Type": "application/json" },
status: 400,
});
}
};
serve(test);
console.log("hello world");
const test = async (req: any) => {
try {
// Set the Auth context of the user that called the function.
// This way your row-level-security (RLS) policies are applied.
supabaseClient.auth.setAuth(
req.headers.get("Authorization")!.replace("Bearer ", "")
);
const { data, error } = await supabaseClient.from("profiles").select("*");
console.log({ data, error });
return new Response(JSON.stringify({ data, error }), {
headers: { "Content-Type": "application/json" },
status: 200,
});
} catch (error) {
return new Response(JSON.stringify({ error: error.message }), {
headers: { "Content-Type": "application/json" },
status: 400,
});
}
};
serve(test);
console.log("hello world");