supabase-kt
supabase-kt copied to clipboard
[Bug]: All object keys must match
General Info
- [X] I checked for similar bug report
- [X] I am using the latest version
- [X] I checked the troubleshooting page for similar problems
Version(s)
2.4.0
Kotlin Target(s) and their respective versions
2.0.0-Beta5
What happened? (include your code)
When i try to bulk upsert, it throws All object keys must match, hence i try to fill all the column with a value still throwing this exception,
but when i try to loop my list then upserting it 1 by 1 it doesnt throw anything
Steps To Reproduce (optional)
No response
Relevant log output (optional)
heres my chucker
URL: https://host_url/rest/v1/job_experience?on_conflict=id
Method: POST
Protocol: h2
Status: Complete
Response: 400
SSL: Yes
Request time: Thu May 09 22:52:57 GMT 2024
Response time: Thu May 09 22:52:57 GMT 2024
Duration: 72 ms
Request size: 558 B
Response size: 85 B
Total size: 643 B
---------- Request ----------
Authorization: Bearer ***
Prefer: return=minimal,resolution=merge-duplicates,missing=default
Content-Profile: public
apikey: ****
X-Client-Info: supabase-kt/2.4.0
Accept: application/json
Accept-Charset: UTF-8
User-Agent: Ktor client
Content-Type: application/json
[
{
"position": "Test Row Edit Juga",
"order": 0,
"company_name": "Company",
"start_date": "2024-05-09T09:55:33.062Z",
"end_date": "2024-05-09T22:52:57.606283Z",
"id": 15,
"auth_ref": "86ca7b6b-1abe-447a-9e33-9ab32eedaf5c",
"is_ongoing_job": true,
"description": "123456",
"created_at": "2024-05-09T09:55:49.034Z"
},
{
"position": "Test Lagi",
"order": 1,
"company_name": "123123",
"start_date": "2024-05-09T10:04:28.965Z",
"end_date": "2024-05-09T22:52:57.606296Z",
"id": 16,
"auth_ref": "86ca7b6b-1abe-447a-9e33-9ab32eedaf5c",
"description": "123123123",
"created_at": "2024-05-09T10:04:37.607Z"
}
]
---------- Response ----------
date: Thu, 09 May 2024 22:52:59 GMT
content-type: application/json; charset=utf-8
cf-ray: 881543583d0a5e96-CGK
cf-cache-status: DYNAMIC
strict-transport-security: max-age=15552000; includeSubDomains
sb-gateway-version: 1
x-envoy-upstream-service-time: 0
vary: Accept-Encoding
server: cloudflare
alt-svc: h3=":443"; ma=86400
{
"code": "PGRST102",
"details": null,
"hint": null,
"message": "All object keys must match"
}
Can you try to use the defaultToNull
parameter when upserting?
@jan-tennert where should i put this ?
Found it and still throwing same error @jan-tennert
Hey there idk why it's suddenly succeeded after several attempt with defaultToNull = true .. gonna try it more
The error shows up again .. so what i try to do is reordering a row .. first when first time insert the row .. the order will equal the id .. then i allow user to reorder the list .. afterthat i bulk upsert the new reordered list .. i do have 1 nullable column .. is that the problem ?
URL: https://**/rest/v1/job_experience?on_conflict=id
Method: POST
Protocol: h2
Status: Complete
Response: 400
SSL: Yes
Request time: Fri May 10 14:31:37 GMT 2024
Response time: Fri May 10 14:31:38 GMT 2024
Duration: 192 ms
Request size: 425 B
Response size: 85 B
Total size: 510 B
---------- Request ----------
Authorization: Bearer **
Prefer: return=minimal,resolution=merge-duplicates
Content-Profile: public
apikey: **
X-Client-Info: supabase-kt/2.4.0
Accept: application/json
Accept-Charset: UTF-8
User-Agent: Ktor client
Content-Type: application/json
[
{
"position": "2",
"order": 0,
"company_name": "2",
"start_date": "2024-05-10T14:31:25.636Z",
"id": 41,
"auth_ref": "86ca7b6b-1abe-447a-9e33-9ab32eedaf5c",
"is_ongoing_job": true,
"description": "",
"created_at": "2024-05-10T14:31:25.636Z"
},
{
"position": "1",
"order": 1,
"company_name": "1",
"start_date": "2024-05-10T14:31:10.755Z",
"id": 40,
"auth_ref": "86ca7b6b-1abe-447a-9e33-9ab32eedaf5c",
"description": "",
"created_at": "2024-05-10T14:31:10.755Z"
}
]
---------- Response ----------
date: Fri, 10 May 2024 14:31:39 GMT
content-type: application/json; charset=utf-8
cf-ray: 881aa2564f7abea7-CGK
cf-cache-status: DYNAMIC
strict-transport-security: max-age=15552000; includeSubDomains
sb-gateway-version: 1
x-envoy-upstream-service-time: 1
vary: Accept-Encoding
server: cloudflare
alt-svc: h3=":443"; ma=86400
{
"code": "PGRST102",
"details": null,
"hint": null,
"message": "All object keys must match"
}
My Chucker Record
Hi @jan-tennert and @Deorigami we had this issue in the other libraries too https://github.com/supabase/postgrest-js/issues/175
You must append a ?columns=collumn1,collumn2,collumn3
in the query param of the request.
The error is being thrown because the is_ongoing_job
field is not sent on all objects.
The error is being thrown because the is_ongoing_job field is not sent on all objects.
Yea, I assumed that was the problem, thanks for linking the fix.
@Deorigami Can you try out version 2.4.1-dev
and check if this issue was fixed?
@jan-tennert @grdsdev Thank you .. its working now
@jan-tennert I am having this same issue on the insert request when inserting multiple rows. Maybe the fix can be applied on that method as well?
@TiagoLira The newest versions should already include this fix.
@jan-tennert I'm using the latest version (2.4.2). The fix was for the UPSERT request, I'm saying that the issue also happens on INSERT.
@jan-tennert I'm using the latest version (2.4.2). The fix was for the UPSERT request, I'm saying that the issue also happens on INSERT.
Right, I will apply this fix there as well once I'm back from vacation. Reopening this as a reminder
@TiagoLira Will be included in 2.5.0-beta-2