1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

supabaseのテーブルにデータを挿入できない

Posted at

supabaseでデータの挿入を行う際にエラーが発生して、更新した値が返されませんでした。

問題のコード

route.ts
const { data, error } = await supabaseClient
          .from("テーブル名")
          .insert([データ])

エラーメッセージ

Error inserting data into Supabase: undefined

解決方法

route.ts
const { data, error } = await supabaseClient
          .from("テーブル名")
          .insert([データ])
          .select();  //これが必要

原因

insert後値を返すには.select()が必要でした。
v2 以降の新機能らしいのでそれ以前の記事などを参考にする際は気をつけて下さい

参考文献

1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?