Open haythaminteractivelifelb opened 2 months ago
Hey @haythaminteractivelifelb I cannot reproduce it, I added 2 date fields for the users collection, completed the reset password workflow.
Also, for what do you use this hook? I don't see the issue with createdAt
, updatedAt
as well. But nevertheless, it works ok the same with the hook / without.
There's an issue that related to createdAt
when using versions though https://github.com/payloadcms/payload/issues/7915 but if this hook fixes it for you, you shouldn't apply it to all the collections
Could you clarify what exact steps we need to do to reproduce this?
it's happened even on fresh and newly created projects!
Quick question! is it possible that this can be combability issue with PostgreSQL version 15?
if no than! in this case I'll suggest that it will be related to dependencies maybe with drizzle or other packages! here's my package & lock files! i hope this can help a bit: package-lock.json package.json
Getting the same error when calling:
payload.update({
collection: 'foo',
id: 1,
data: {
title: 'bar'
}
})
On this collection with 1 doc in it:
{
slug: 'foo',
fields: [
{
type: 'text',
name: 'title'
}
]
}
And this hook is enough to fix it:
beforeChange: [
({ originalDoc, data }) => {
if (originalDoc?.createdAt) {
data.createdAt = originalDoc.createdAt;
}
}
]
Quick question! is it possible that this can be combability issue with PostgreSQL version 15?
I don't think so Please, create a minimal reproduction repo, can be from this repository in the _community test config as well.
Hi, there, how it's going on? We're also experiencing the issue
Hey @BohdanK-W32, I couldn't reproduce this at the time. Do you have more details or the same as above? I will try it again soon.
Hi, @r1tsuu Unfortunately, I cannot share the reproduction due to NDA. However I can tell that it happens only during the updates triggered by program logic (so not happening if we use admin UI), on two collections Users and Orders (I think it's applicable to any collection with timestamps).
However the workaround provided above works like a charm
I'd like to see a minimum reproduction repository if it still happens
@r1tsuu here is a complete reproduction workflow and detailed error message
I was able to replicate this on Postgres 14.10
Reproduction steps:
createdb reproduction
npx create-payload-app
reproduction
for autofill)payload-demo
as the project templatePostgreSQL (beta)
as the databasepostgres://127.0.0.1:5432/reproduction
(may be autofilled)npm run dev
Observe the following error:
reproduction » npm run dev
> reproduction@1.0.0 dev
> cross-env PAYLOAD_CONFIG_PATH=src/payload/payload.config.ts nodemon
[nodemon] 3.0.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: ts
[nodemon] starting `ts-node src/server.ts`
[✓] Pulling schema from database...
[15:28:53] INFO (payload): Starting Payload...
[15:28:53] INFO (payload): Payload Admin URL: http://localhost:3000/admin
[15:28:53] INFO (payload): Seeding database...
[15:28:53] INFO (payload): — Clearing media...
[15:28:53] INFO (payload): — Clearing collections and globals...
[15:28:53] INFO (payload): — Seeding demo author and user...
[15:28:54] INFO (payload): — Seeding media...
error: invalid input syntax for type timestamp with time zone: ""
at /Users/freeman/Projects/reproduction/node_modules/pg/lib/client.js:526:17
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /Users/freeman/Projects/reproduction/node_modules/src/node-postgres/session.ts:66:19
at async upsertRow (/Users/freeman/Projects/reproduction/node_modules/@payloadcms/db-postgres/src/upsertRow/index.ts:63:24)
at async Object.create (/Users/freeman/Projects/reproduction/node_modules/@payloadcms/db-postgres/src/create.ts:17:18)
at async create (/Users/freeman/Projects/reproduction/node_modules/payload/src/collections/operations/create.ts:253:15) {
length: 158,
severity: 'ERROR',
code: '22007',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: "unnamed portal parameter $4 = ''",
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'datetime.c',
line: '3803',
routine: 'DateTimeParseError'
}
Attention: Next.js now collects completely anonymous telemetry regarding usage.
This information is used to shape Next.js' roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://nextjs.org/telemetry
[15:28:54] ERROR (payload): Error seeding database.
Moved From https://github.com/payloadcms/payload/issues/7126#issuecomment-2323349544 as requested by @r1tsuu
Link to reproduction
No response
Environment Info
Describe the Bug
I'm on Beta-96 with PostgreSQL 15 Database and I faced this issue from the start in 3.0.0-beta.42 with createdAt and updatedAt fields and I did a simple work around just for these 2 fields assuming that this is related only to this 2 fields. the solution was by adding this hook to all collections:
However after adding more date fields this issue came back to the Top as i added 2 new fields
and I was able to save them, at the start i thought that I cannot but after that I noticed that I'm able to save it for some users and not others.
the error is :
Reproduction Steps
As explained above! After further debugging I've noticed that the issue is coming from another Date Field
resetPasswordExpiration
, so if the user resettled his password, he will got this date issue all the time as I cannot find a work around for this field!Adapters and Plugins
No response