9
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

はじめに

久しぶりにSupabaseを使って忘れていて少し時間を使った箇所があったのでかいておきます

問題

Supabaseのデータを取得するような処理を書きました

export const getEvents = async () => {
  const { data, error } = await supabase.from("events").select("*");

  if (error) {
    console.log(error);
  }

  return data;
};

しかし返ってくるdataは[]となっていました

解決方法

これはSupabaseのデータベースにあるRLSというセキュリティがかかっているのが原因です

image.png

ここを設定することでうまくいきました
すぐに確認するならdisabledにしてしまうのもよいかもです(あとで設定はしましょう)

おわりに

3回くらい同じことで躓いている気がする

9
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?