How do I use supabase upsert onConflict in custom code?

Custom Code

Can anyone tell me how to successfully implement this upsert statement? (It's from the supabase docs Supabase Javascript Client - Upsert data, but when I try to use onConflict in my custom action, it responds with these 2 errors:

Error: Undefined name 'onConflict'.

onConflict: 'handle'

^^^^^^^^^^

Error: Too many positional arguments: 1 allowed, but 2 found.

Try removing the extra positional arguments.

.upsert({

^

await supabase
  .from('users')
  .upsert({ id: 42, handle: 'saoirse', display_name: 'Saoirse' }, { onConflict: 'handle' })
What have you tried so far?

I tried for hours to get it to work now and couldn't figure it out. Other optional parameters like ignoreDuplicates give the same error.

If I change <onConflict: 'handle'> to <'onConflict': 'handle'>, it still gives me this error:

Error: Too many positional arguments: 1 allowed, but 2 found.

Try removing the extra positional arguments.

.upsert({

^

EDIT:

I just realized flutterflow automatically imports supabase_flutter: ^1.10.24 and newer versions arent compatible with supabase 1.11.11 which is used by flutterflow.
If I overwrite supabase both with newer versions the build fails due to other dependencies (see screenshots).

Is anyone working on updating all of this stuff?

Did you check FlutterFlow's Documentation for this topic?
Yes
2
1 reply