Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: All object keys must match #589

Closed
3 tasks done
Deorigami opened this issue May 9, 2024 · 13 comments · Fixed by #590
Closed
3 tasks done

[Bug]: All object keys must match #589

Deorigami opened this issue May 9, 2024 · 13 comments · Fixed by #590
Labels
bug Something isn't working

Comments

@Deorigami
Copy link

General Info

  • I checked for similar bug report
  • I am using the latest version
  • 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,
Screenshot 2024-05-10 at 05 55 06
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"
}
@Deorigami Deorigami added the bug Something isn't working label May 9, 2024
@jan-tennert
Copy link
Collaborator

Can you try to use the defaultToNull parameter when upserting?

@Deorigami
Copy link
Author

@jan-tennert where should i put this ?

@Deorigami
Copy link
Author

Found it and still throwing same error @jan-tennert

@Deorigami
Copy link
Author

Hey there idk why it's suddenly succeeded after several attempt with defaultToNull = true .. gonna try it more

@Deorigami
Copy link
Author

Deorigami commented May 10, 2024

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 ?

Screenshot 2024-05-10 at 21 35 52

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

@grdsdev
Copy link
Contributor

grdsdev commented May 10, 2024

Hi @jan-tennert and @Deorigami we had this issue in the other libraries too supabase/postgrest-js#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.

@jan-tennert
Copy link
Collaborator

jan-tennert commented May 10, 2024

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?

@Deorigami
Copy link
Author

@jan-tennert @grdsdev Thank you .. its working now

@TiagoLira
Copy link

@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?

@jan-tennert
Copy link
Collaborator

jan-tennert commented May 29, 2024

@TiagoLira The newest versions should already include this fix.

@TiagoLira
Copy link

@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
Copy link
Collaborator

@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

@jan-tennert jan-tennert reopened this May 29, 2024
@jan-tennert
Copy link
Collaborator

@TiagoLira Will be included in 2.5.0-beta-2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants