Whats the correct format for Supabase metadata and REST header?

Hi!
See screenshot, Im setting a custom JSON as Supabase sign up metadata but got the type error on screen. It seems that I shouldn’t return a JSON as shown in screenshot. Actually I have the same error when trying to set a custom set of REST request header. What is the correct format here when trying to customize the entire set of key-value pair? Thank you!

Hi

It expect an array of objects formatted like this :

[{key: 'myKey', value: 'myValue'}]
1 Like

hey @Alexis

I am trying to use your entry style here and unfortunately this is not passing values to the api call>

[UPDATE]

please see the video for my confusion and the solution

it’s not [{key:value}]. you define your metadata key as the value of key. in the array of objects and likewise for the value.

1 Like

Yeah, its something we still have issue to explain in our UI, sorry for the confusion. Good continuation :slight_smile:

1 Like

Just stumbled upon this when trying to pass dynamic metadata. Would be great if it could be simplified in the new plugin maybe? Because like, this format is for WeWeb’s convention, not for Supabase right?

Yes its an old UX issue. As we use our array input for everything requiring a key/value object (like rest api headers and supabase metadata) people have to bind an array but most of people knowing a little bit about what they are doing will try to bind an object.

We plan to make an object input variant, same UI but the ‘add item’ will be replaced by ‘add property’ and it will use the object format instead of an array.

Indeed, I was soooo confused, when I tried to cram an object in there and it was like, damn, I ain’t reducing your object man. Then when I found about this array thing, it made sense why there was an Array.reduce error.