Resolve dates being {} when updating "\"[object Object]\" is not a valid date." #6180
alexander-chi
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Afternoon all!
I'm not sure where the best place to post this is but I figured it would be helpful for anyone else who encountered this issue.
When updating a document with partial properties, any dates in the document to be merged where coming through as {}. This caused validation errors whenever you tried to update a document.
I could not replicate it in the community template or on a fresh install. After spending several hours on it, I started crawling through the package-lock.json and comparing dependencies.
The culprit in our case was @types/pg, we had 8.11.5 listed as a dependency which has a dependency of pg-types 4.x.x which in turn depends on postgres-date 2.x.x.
postgres-date 2.x.x is incompatible with the 1.x.x version required by the dependency chain @payloadcms/db-postgres -> pg 8.11.3 -> pg-types 2.1.0 -> postgres-date 1.0.4
I'm unsure how this occurred and how to prevent it from occurring in the future however adding "pg-types": "2.2.0" as an explicit dependency resolved it for us.
Hope this helps anyone else facing this issue!
Beta Was this translation helpful? Give feedback.
All reactions