Error 'All object keys must match'
See original GitHub issueBug report
Describe the bug
When trying to insert an array of objects, where in some objects the key field2
is present, and in others isn’t, the JS API client errors to: ‘All object keys must match’. The field2
is not mandatory.
const { data, error } = await supabase
.from('mytable')
.insert([
{
field1: 'something'
},
{
field1: 'something',
field2: 'something'
}
])
Desired behavior
The JS client / Supabase should default the mismatching fields to null
or whatever is translated to NULL in Postgres. (As workaround I set the fields to null
and it looks OK in my case.)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:13
- Comments:14 (2 by maintainers)
Top Results From Across the Web
Random problems trying to create a row in Supabase
The error message I get is " ERROR: Bad request - please check your parameters. All object keys must match". All values are...
Read more >How to type-enforce object value to match object key?
We want to be able to just look at an object and see if its keys match its category strings. We can do...
Read more >Object.keys() - JavaScript - MDN Web Docs
The Object.keys() method returns an array of a given object's own enumerable string-keyed property names.
Read more >Objects - The Modern JavaScript Tutorial
So we must understand them first before going in-depth anywhere else. An object ... Every piece of data is stored in its file...
Read more >Creating object key names - Amazon Simple Storage Service
To ensure the correct parsing of object keys in XML requests, carriage returns and other special characters must be replaced with their equivalent...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
+1 for this. I mean, I thought that is what upsert is for.
I have multiple rows…if I add a new one, it doesn’t have an ID yet…so, I would expect existing items get updated, while the new one, gets inserted.
I would like to know about this myself since I’m trying to upsert.
In my situation I can have references to the ids of the rows but in the same operation I also need to add new rows of which I do not have an identifier.
This returns
{"message":"All object keys must match"}
summing up the upsert does not do what I expect that is to add new rows and update those already in db in the same operation.
this forces me to have to make two separate api calls for insert and update